zego_uikit_prebuilt_live_streaming 1.2.2 zego_uikit_prebuilt_live_streaming: ^1.2.2 copied to clipboard
PrebuiltLiveStreaming is a full-featured live streaming kit that provides ready-made video streaming, live text chat, face beautification, and supports unlimited viewers.
Quick start #
Integrate the SDK #
Add ZegoUIKitPrebuiltLiveStreaming as dependencies #
Run the following code in your project root directory:
flutter pub get zego_uikit_prebuilt_live_streaming
This will add a line like this to your project's pubspec.yaml
file (and Flutter will automatic run an implicit flutter pub get
):
dependencies:
zego_uikit_prebuilt_live_streaming: ^1.2.2 # Add this line
Import the SDK #
Now in your Dart code, import the prebuilt Video Call Kit SDK.
import 'package:zego_uikit_prebuilt_live_streaming/zego_uikit_prebuilt_live_streaming';
Integrate the live streaming #
You can get the AppID and AppSign from ZEGOCLOUD's Console.
Users who use the same liveID can in the same live streaming. (ZegoUIKitPrebuiltLiveStreaming supports 1 host Live for now)
you can customize UI by config properties
@override
Widget build(BuildContext context) {
return SafeArea(
child: ZegoUIKitPrebuiltLiveStreaming(
appID: /*Your App ID*/,
appSign: /*Your App Sign*/,
userID: user_id, // userID should only contain numbers, English characters and '_'
userName: 'user_name',
liveID: 'live_id',
config: isHost
? ZegoUIKitPrebuiltLiveStreamingConfig.host()
: ZegoUIKitPrebuiltLiveStreamingConfig.audience(),
),
);
}
Now, you can start a live stream, other people who enter the same 'live name' can watch your live stream.
How to run #
1. Config your project #
Android
-
If your project was created with a version of flutter that is not the latest stable, you may need to manually modify compileSdkVersion in
your_project/android/app/build.gradle
to 33 -
Need to add app permissions, Open the file
your_project/app/src/main/AndroidManifest.xml
, add the following code:<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" />
iOS:
- Add app permissions.
a. open the your_project/ios/Podfile
file, and add the following to the post_install do |installer|
part:
# Start of the permission_handler configuration
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
'PERMISSION_CAMERA=1',
'PERMISSION_MICROPHONE=1',
]
end
# End of the permission_handler configuration
b. open the your_project/ios/Runner/Info.plist
file, and add the following to the dict
part:
<key>NSCameraUsageDescription</key>
<string>We require camera access to connect to a live</string>
<key>NSMicrophoneUsageDescription</key>
<string>We require microphone access to connect to a live</string>
Turn off some classes's confusion
To prevent the ZEGO SDK public class names from being obfuscated, please complete the following steps:
- Create
proguard-rules.pro
file under [your_project > android > app] with content as show below:
-keep class **.zego.** { *; }
- Add the following config code to the release part of the
your_project/android/app/build.gradle
file.
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2. Build & Run #
Now you can simply click the "Run" or "Debug" button to build and run your App on your device.