All Products
Search
Document Center

ApsaraVideo Live:SDK integration

Last Updated:Dec 28, 2023

This topic describes how to integrate Push SDK for Flutter.

Prerequisites

Android Studio or Visual Studio Code is installed.

Environment requirements

Item

Requirement

Flutter version

2.5.0 or later. For more information about how to download Flutter, see Flutter SDK archive.

Dart version

Versions between 2.12.0 and 3.0.0.

OS version

Android 5.0 or later.

CPU architecture

armeabi-v7a or arm64-v8a.

Development tool

Android Studio or Visual Studio Code.

Procedure

  1. Add the following dependency to the pubspec.yaml file of your local project:

    dependencies:
      flutter_livepush_plugin: ^{{latest version}}
    Note

    See flutter_livepush_plugin for the latest version.

  2. Add relevant system permission statements.

    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 the configurations that authorize access to the camera and microphone to the Info.plist file of the 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>
  3. Configure other project settings.

    In Android, add the following rules to the obfuscation rule file.

    Note

    If obfuscation is enabled for your application, you must configure obfuscation rules. Otherwise, a crash occurs when you use Push SDK. For the latest obfuscation configuration, see the source code of the demo.

    -keep class org.webrtc.** { *; }
    -keep class com.alivc.** { *; }
    -keep class com.aliyun.** { *; }
    -keep class com.cicada.** { *; }
  4. Configure a license.

    An all-in-one license is used together with Push SDK for Flutter. For more information about how to apply for and configure a license, see Integrate a Push SDK license.

SDK usage notes