Integrate the Push SDK to enable live stream pushing in your Flutter application.
Prerequisites
Android Studio or Visual Studio Code is installed.
Environment requirements
Category | Requirement |
Flutter version | Version 2.5.0 or later, but earlier than 3.0.0. Version 2.8.0 is recommended. |
Dart version | Version 2.12.0 or later, but earlier than 3.0.0. |
System Version |
|
CPU architecture | armeabi-v7a or arm64-v8a. |
Development tools | Use Android Studio or Visual Studio Code. |
Procedure
-
Integrate the SDK.
Choose one of the following methods:
Add dependency
Add the following dependency to the
pubspec.yamlfile of your local project:dependencies: flutter_livepush_plugin: ^x.y.zNoteReplace
x.y.zwith the actual version number of the Push SDK, such as 7.1.0. For the latest version, see SDK download.Use command-line tool
flutter pub add flutter_livepush_pluginThis command automatically updates your
pubspec.yamlfile.Local Integration
Create a
pluginsdirectory in your project and place the SDK in this directory. Then, add the following dependency to thepubspec.yamlfile:flutter_livepush_plugin: path: "./plugins/flutter_livepush_plugin" // SDK storage pathNoteFor latest SDK version, see SDK download.
-
Run the following command to install the dependency.
flutter pub get -
Add the required system permissions.
Android
Open the ./android/app/src/main/AndroidManifest.xml file and declare the required permissions.
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECORD_AUDIO" />iOS
Add camera and microphone access permissions to the Info.plist file of your project.
<key>NSCameraUsageDescription</key> <string>Authorize access to the camera for video streaming</string> <key>NSMicrophoneUsageDescription</key> <string>Authorize access to the microphone for audio streaming</string> -
Configure other project settings.
In Android, add the following rules to the obfuscation rule file.
NoteIf obfuscation is enabled for your application, you must configure obfuscation rules to prevent crashes. For the latest obfuscation configuration, see the demo source code.
-keep class org.webrtc.** { *; } -keep class com.alivc.** { *; } -keep class com.aliyun.** { *; } -keep class com.cicada.** { *; } -
Configure a license.
To integrate a license, see License Integration Guide.
References
-
For details about SDK methods, see Push SDK for Flutter API Documentation.
-
For sample code, see Use Push SDK for Flutter.