An ApsaraVideo Media SDK license binds to an application identifier to authorize SDK calls. After obtaining a license, integrate it with the Push SDK, short video SDK, ApsaraVideo Player SDK, or Queen SDK to complete authorization on web, Android, iOS, and HarmonyOS clients.
Prerequisites
A license file and License Key obtained from Manage a license.
Authentication flow
License authentication relies on a License Key and a license file.
Item | Required | Description | |||||
License Key | Yes | Used to request updates for the license file. The SDK checks for updates during initialization and every 15 minutes at runtime. | |||||
License file | No. Recommended Configuration | Fallback for authentication when the server-side certificate request fails, such as during network outages. The certificate file stores enabled permissions and validity period. Update it when permissions change to maintain reliability in weak network environments. Note
| |||||
To skip the built-in license file, omit the LicenseFile configuration in the platform-specific steps below.
Without a built-in certificate file, authentication relies entirely on the server. Network fluctuations may cause instability, and first-time users must wait for the certificate download to complete before authentication succeeds.
ApsaraVideo Player SDK service environments
ApsaraVideo Player SDK V6.14.0 and later provide multiple service environments for global compliance. The selected environment determines which service center handles license authentication and playback quality data.
Alibaba Cloud China Website (www.aliyun.com) users can use either the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment or the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment (Singapore node). V6.14.0 and later default to the China site environment.
Environment | Description |
The Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) | The Alibaba Cloud China Website (www.aliyun.com) environment (default). Uses the Shanghai, China node to serve users in the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China). |
Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) | The Alibaba Cloud International Website environment. Uses the Singapore node for compliance and performance in regions outside the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China). |
Video tutorials
This example demonstrates license integration with ApsaraVideo Player SDK.
Android
iOS
Flutter
HarmonyOS
Integrate a license on the web client
Obtain the License Key from the console.

When initializing the player, pass the license field, which includes the registered domain name and the License Key:
var player = new Aliplayer({ license: { domain: "example.com", // The domain name you entered when you applied for the license key: "example-key" // The License Key you can view in the console after a successful application } });If no error messages appear after initialization, the license is configured successfully.
NoteThe page domain must match or be a subdomain of the domain registered in your license application. Otherwise, verification fails.
Integrate a license on Android
Configure the license.
(Recommended) Copy the certificate file to the assets directory in your Android Studio project.
NoteYou can also copy the certificate file to another location on the device. However, ensure the value of
com.aliyun.alivc_license.licensefile(for the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) orcom.aliyun.alivc_license.licensefile_SEA(for Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China))) matches the path of the license file.In the AndroidManifest.xml file, add a <meta-data> node.
ImportantIf authentication fails after you configure the license, check whether the <meta-data> elements are added under the <application> element and whether the names in the <meta-data> elements are correct. If the issue persists, see FAQ about licenses for troubleshooting.
For Alibaba Cloud International Website (www.alibabacloud.com) users, if you use ApsaraVideo Player SDK V6.14.0 or later, configure a license for the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment. If you do not use the ApsaraVideo Player SDK, configure a license only for the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment.
You can integrate two sets of licenses: one for the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment and one for the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment. After integrating the licenses, specify the operating environment for the player by configuring its service environment each time the app starts. You cannot switch the environment while the player is running.

// Configure the license for the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) (default China site configuration) <meta-data android:name="com.aliyun.alivc_license.licensekey" android:value="foIVziMaUHaRqgDyhf6b6eb8fcf014af39535d0720a32****"/> <!-- TODO: Set your LicenseKey value. --> <meta-data android:name="com.aliyun.alivc_license.licensefile" android:value="assets/cert/release.crt"/> <!-- TODO: Set the path of your license file. --> // Configure the license for the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment. Manually add _SEA to the end of the name. <meta-data android:name="com.aliyun.alivc_license.licensekey_SEA" android:value="f6b6foIVziMaUHaRqgDyheb8fcf014af39535d0a32720****"/> <!-- TODO: Set your LicenseKey value. --> <meta-data android:name="com.aliyun.alivc_license.licensefile_SEA" android:value="assets/cert/release.crt"/> <!-- TODO: Set the path of your license file. -->
Configure the service environment for ApsaraVideo Player SDK (required for the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment).
ApsaraVideo Player SDK V6.14.0 and later default to the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment. Alibaba Cloud International Website users must switch to the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment using one of the following methods. Otherwise, license authentication fails. For other versions and SDK usage scenarios, ignore this step.
Method 1: Call the following API to update the default configuration to the international site environment.
// If you use the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment, ensure you call the following interface to update the default configuration to the international site environment before calling any player API. This ensures all subsequent services run in the international site environment. // Use the unified AlivcBase interface to set the international site environment. You cannot modify the environment at runtime. AlivcBase.getEnvironmentManager().setGlobalEnvironment(AlivcEnv.GlobalEnv.ENV_SEA);Method 2 (Recommended): For ApsaraVideo Player SDK V7.6.0 and later, configure the international site environment using the
XMLmethod.In the
AndroidManifest.xmlfile, add a<meta-data>node.<meta-data android:name="com.aliyun.alivc_env" android:value="SEA"/>The following figure shows a configuration example:

Integrate a license on iOS
Configure the license.
In your Xcode project, copy the certificate file
AliVideoCert-********.crtinto the project. We recommend placing it in the AppSupportFiles directory. You can also place it in the sandbox or another path. In Target Membership, select the current project.
Open the Info.plist file. Set AlivcLicenseKey and AlivcLicenseFile (for the China environment) or AlivcLicenseKey_SEA and AlivcLicenseFile_SEA (for the International environment) to the License Key and license file path obtained from Manage a license.
ImportantFor Alibaba Cloud International Website (www.alibabacloud.com) users, if you use ApsaraVideo Player SDK V6.14.0 or later, configure a license for the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment. If you do not use the ApsaraVideo Player SDK, configure a license only for the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment.
You can integrate two sets of licenses: one for the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment and one for the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment. After integrating the licenses, specify the operating environment for the player by configuring its service environment each time the app starts. You cannot switch the environment while the player is running.
// Configure the license for the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) (default configuration) <key>AlivcLicenseFile</key> <string>XXX</string> <key>AlivcLicenseKey</key> <string>foIVziMaUHaRqgDyhf6b6eb8fcf014af39535d0720a32****</string> // Configure the license for the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment. Manually add _SEA to the end of the key name. <key>AlivcLicenseFile_SEA</key> <string>XXX</string> <key>AlivcLicenseKey_SEA</key> <string>f6b6efoIVziMaUHaRqgDyhb8fcf014af39535d0a32072****</string>
Configure the service environment for ApsaraVideo Player SDK (required for the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment).
ApsaraVideo Player SDK V6.14.0 and later default to the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment. Alibaba Cloud International Website users must switch to the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment using one of the following methods. Otherwise, license authentication fails. For other versions and SDK usage scenarios, ignore this step.
Method 1: Call the following API to update the default configuration to the international site environment.
// If you use the Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) environment, ensure you call the following interface to update the default configuration to the international site environment before calling any player API. This ensures all subsequent services run in the international site environment. // Use the unified AlivcBase interface to set the international site environment. You cannot modify the environment at runtime. AlivcBase.EnvironmentManager.globalEnvironment = ENV_SEA;Method 2 (Recommended): For ApsaraVideo Player SDK V7.6.0 and later, configure the international site environment using the
Info.Plistmethod.Open the
Info.plistfile and setAlivcEnvtoSEA.// Configure the current environment as the international site environment. <key>AlivcEnv</key> <string>SEA</string>The following figure shows a configuration example:

Integrate a license on Flutter
For Flutter applications, integrate the license on each supported platform: Integrate a license on Android or Integrate a license on iOS.
Integrate a license on HarmonyOS
Copy the obtained license certificate file into your DevEco Studio project. We recommend placing it in the rawfile directory.
In the module.json5 file, add the following fields.

The key is
com.aliyun.alivc_license.licensekey(all lowercase), and the value is your License Key.The key is
com.aliyun.alivc_license.licensefile(all lowercase), and the value is the path to the certificate file from the previous step. Specify the path as needed."metadata": [ { "name": "com.aliyun.alivc_license.licensekey", "value": "********" }, { "name": "com.aliyun.alivc_license.licensefile", "value": "license.crt" }, ]

