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

Project description

The native layer of ApsaraVideo Player SDK for Flutter is developed 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. For more information about the source code of the latest version of ApsaraVideo Player SDK for Flutter, see SDK download.

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.

Folder Description Required
android The native code for Android and ApsaraVideo Player SDK for Android. Yes
ios The native code for iOS and ApsaraVideo Player SDK for iOS. Yes
lib The code of the API for Flutter. Yes
example The 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 method

You can integrate ApsaraVideo Player for Flutter by adding flutter_aliplayer as a dependency to the pubspec.yaml file of the project.
dependencies:
  flutter_aliplayer: ^version
# version indicates the version number of ApsaraVideo Player for Flutter, such as 5.4.0. Select a version based on your business requirements. 

Integration operations

Environment preparation

Install Flutter. To download Flutter, go to Flutter SDK releases. For more information about version support, see Release notes of ApsaraVideo Player SDK for Flutter.

How to integrate ApsaraVideo Player SDK for Flutter

Note The following procedure shows you how to integrate ApsaraVideo Player SDK for Flutter in Visual Studio (VS) Code 1.65.2. The procedure for integrating ApsaraVideo Player SDK for Flutter by using other development tools is similar.
  1. Start the VS Code development tool.
  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 the location for storing the project and click OK.
    Wait for the project to be created. If the main.dart file appears, the project is created.
  6. Add flutter_aliplayer as a dependency to the pubspec.yaml file.
    dependencies:
      flutter_aliplayer: ^version
    # version indicates the version number of ApsaraVideo Player for Flutter, such as 5.4.0. Select a version based on your business requirements. 
  7. If your business scenario requires real-time streaming (RTS), add the following dependencies to the file.RTS For more information about RTS, see Overview.
    Note You can obtain the version numbers of RTS SDK and ApsaraVideo Player SDK for Flutter from the CHANGELOG.md file of the flutter_aliplayer project.
     flutter_aliplayer_artc: ^version
     flutter_aliplayer_rts: ^version
    # version indicates the version number. Example: flutter_aliplayer_artc: ^5.2.3 and flutter_aliplayer_rts: ^1.5.0. Select a version based on your business requirements.