This topic describes the supported systems, development environments, and integration methods of ApsaraVideo Player SDK for Android. This topic also describes how to integrate the SDK.
Supported systems
Android 4.0 and later are supported. The following processor architectures of mobile
phones are supported:
- ARMv7
- ARM64
Note This topic describes how to integrate ApsaraVideo Player SDK V4.5.0 or later. If you
use an earlier SDK version, update it to ApsaraVideo Player SDK V4.5.0 or later. For
more information, see Update ApsaraVideo Player SDK for Android from V3.x.x to V4.5.0.
Environment preparation
We recommend that you use Android Studio as the development tool. This topic is based on the Android Studio development environment.
Integration methods
- Integrate the SDK by using on-premises files
- Download the SDK
Download the latest version of ApsaraVideo Player SDK for Android. For more information, see Release notes of ApsaraVideo Player SDK for Android.
- SDK structure
The SDK package contains the following .aar files:
- AliyunPlayer-4.5.0-full.aar: a complete AAR package that contains FFmpeg dynamic frameworks.
- AliyunPlayer-4.5.0-part.aar: an AAR package that does not contain FFmpeg dynamic frameworks.
- To integrate a player SDK without the feature of short video playback, use AliyunPlayer-4.5.0-full.aar as the dependency.
- To integrate a player SDK that supports short video playback, you must use AliyunPlayer-4.5.0-part.aar
as the dependency. In addition, you must add the com.aliyun.video.android:AlivcFFmpeg:1.0.0
package, the version of which is compatible for both the player SDK and the short
video SDK.
Note An FFmpeg error may occur if you choose an invalid dependency for SDK integration.
- Integration procedure
- Copy the required AAR package to the libs directory of your project. Create a libs
directory if it does not exist.
- In the build.gradle file, declare the position of the libs directory in the repositories
part of the allprojects block, and add Alibaba Cloud Maven repository URL to the build.gradle
file. Example:
The following figure shows the result of the preceding operations.maven { url 'https://maven.aliyun.com/repository/releases' } flatDir { dirs 'libs' }
- Add the reference to the AAR package and the Gradle package com.alivc.conan:AlivcConan:0.9.5
to the dependencies part in the build.gradle file. Example:
The following figure shows the result of the preceding operations.dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // Other dependencies. // Two dependencies of ApsaraVideo Player. implementation (name:'AliyunPlayer-4.5.0-full',ext:'aar') implementation 'com.alivc.conan:AlivcConan:0.9.5' }
Click build.gradle to complete the integration. After ApsaraVideo Player SDK for Android is integrated, the APK file size increases by about 7.5 MB.
- Copy the required AAR package to the libs directory of your project. Create a libs
directory if it does not exist.
- Obfuscation configuration
The following code shows the obfuscation configuration:
-keep class com.alivc.**{*;} -keep class com.aliyun.**{*;} -keep class com.cicada.**{*;} -dontwarn com.alivc.** -dontwarn com.aliyun.** -dontwarn com.cicada. **
- Download the SDK
- Integrate the SDK by using the Gradle package
- Add Alibaba Cloud Maven repository URL to the buildscript block and the allprojects
block in the build.gradle file. Example:
The following figure shows the result of the preceding operations.maven(){ url 'https://maven.aliyun.com/repository/releases' }
- Add the reference to the AAR package to the dependencies part in the build.gradle
file. Example:
The following figure shows the result of the preceding operations.implementation 'com.aliyun.sdk.android:AliyunPlayer:4.5.0-full' implementation 'com.alivc.conan:AlivcConan:0.9.5'
- Click build.gradle to complete the integration. After ApsaraVideo Player SDK for Android is integrated, the APK file size increases by about 7.5 MB.
- Add Alibaba Cloud Maven repository URL to the buildscript block and the allprojects
block in the build.gradle file. Example: