This topic provides an overview of ApsaraVideo Player SDK for Flutter and describes how to integrate ApsaraVideo Player SDK for Flutter.

Environment requirements

ItemRequirement
Flutter versionFlutter 3.3.0 on the Stable channel
Dart versionDart 2.18.0
OS versionAndroid 5.0 or later
Mobile phone processorarmeabi-v7a or arm64-v8a
Development toolRecommended: Android Studio or Visual Studio (VS) Code

SDK download

Note A specific version of ApsaraVideo Player SDK for Flutter supports specific versions of Flutter SDK. For example, ApsaraVideo Player SDK for Flutter V5.4.0 supports only Flutter SDK 2.0 or later. For more information, see Release notes for ApsaraVideo Player SDK for Flutter.

Project description

The native layer of ApsaraVideo Player SDK for Flutter is based on ApsaraVideo Player SDK for Android and ApsaraVideo Player SDK for iOS. The source code is included in the dependencies of the demo. You can modify the source code based on your business requirements.

The following figure shows the directory structure of a project.Directory structure of ApsaraVideo Player SDK for Flutter

The following table describes the folders in the directory.

FolderDescriptionRequired
androidThe native code for Android and ApsaraVideo Player SDK for Android. Yes
iosThe native code for iOS and ApsaraVideo Player SDK for iOS. Yes
libThe code of the API for Flutter. Yes
exampleThe demo of ApsaraVideo Player for Flutter. No

Limits

ApsaraVideo Player SDK for Android does not support emulators. After the integration is complete, you must run the SDK on a device.

Integration

Note The following procedure shows how to integrate ApsaraVideo Player SDK for Flutter in VS Code 1.65.2. The procedure for integrating ApsaraVideo Player SDK for Flutter by using other development tools is similar.
  1. Start VS Code.
  2. Choose View > Command Palette….
  3. Enter flutter and select Flutter: New Project.
  4. Enter a project name such as myapp and press the Enter key.
  5. Specify a location for storing the project and click OK.
    Wait for the project creation to finish. When the main.dart file appears, the project is created.
  6. Integrate ApsaraVideo Player SDK for Flutter into your project.
    You can integrate ApsaraVideo Player SDK for Flutter by adding flutter_aliplayer as a dependency to the pubspec.yaml file of the project.
    dependencies:
      flutter_aliplayer: ^version
    # version specifies the version number of ApsaraVideo Player SDK for Flutter, such as 5.4.0. Replace version with the actual version number. 
  7. Optional:If your business scenario requires RTS, add the following dependencies. For more information about RTS, see Overview.
    You can use one of the following methods:
    Note The version numbers used in the following examples are for reference only. For more information about the latest versions of ApsaraVideo Player SDK, see Release notes for ApsaraVideo Player SDK for Android and Release notes for ApsaraVideo Player SDK for iOS. For more information about the latest versions of RTS SDKs, see Download SDKs.
    • Method 1: Implement integration on the native layer of your Android or iOS device
      Android: Include the dependencies in the build.gradle file. Example:
      dependencies{
          implementation 'com.aliyun.sdk.android:AlivcArtc:$version'
          implementation 'com.aliyun.rts.android:RtsSDK:$version'
      }
      # In com.aliyun.sdk.android:AlivcArtc:$version, $version specifies the version number of ApsaraVideo Player SDK for Android. In com.aliyun.rts.android:RtsSDK:$version, $version specifies the version number of RTS SDK for Android. Examples: 'com.aliyun.sdk.android:AlivcArtc:5.4.9.1' and 'com.aliyun.rts.android:RtsSDK:2.5.0'.
      iOS: Include the dependencies in the Podfile file. Example:
      target 'Runner' do
        flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
      
        pod 'AliPlayerSDK_iOS_ARTC', '$version'  #$version specifies the version number of ApsaraVideo Player SDK for iOS. Example: 5.4.9.1.
        pod 'RtsSDK', '$version'  #$version specifies the version number of RTS SDK for iOS. Example: 2.5.0.
      
      end
    • Method 2: Use the Flutter plug-in

      Update support for this method has ended. You cannot obtain the latest versions of RTS SDK and ApsaraVideo Player SDK by using the Flutter plug-in. You can obtain the version numbers of RTS SDK and ApsaraVideo Player SDK from the CHANGELOG.md file of the flutter_aliplayer project.

       flutter_aliplayer_artc: ^version
       flutter_aliplayer_rts: ^version
      # version specifies the version number. Examples: flutter_aliplayer_artc: ^5.2.3 and flutter_aliplayer_rts: ^1.5.0. Replace version with the actual version number. 

FAQ

Can I debug apps on the Xcode simulator after I integrate ApsaraVideo Player SDK on iOS devices?

We recommend that you use an iPhone for debugging. If an error similar to the one shown in the following figure occurs when you use Xcode 14 to compile apps on the iOS simulator, comment out setFilterConfig:, updateFilterConfig:, and setFilterInvalid: and the code that is used to call these operations in ApsaraVideo Player SDK for Flutter. Sample code