An ApsaraVideo Media SDK license binds to an app identifier to authorize SDK calls. After you obtain a license, integrate it with the Push SDK, short video SDK, ApsaraVideo Player SDK, or Queen SDK on web, Android and iOS 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 |
Requests license file updates. The SDK checks at initialization and every 15 minutes at runtime. |
|||||
|
License file |
No. Recommended Configuration |
Authentication fallback when the server-side certificate request fails, such as during network outages. Stores enabled permissions and validity period. Update it when permissions change to maintain reliability in weak network conditions. 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 issues may cause instability, and first-time users must wait for the certificate download before authentication succeeds.
ApsaraVideo Player SDK service environments
ApsaraVideo Player SDK V6.14.0 and later support multiple service environments for global compliance. The environment determines which service center handles license authentication and playback quality data.
Alibaba Cloud International Website (www.alibabacloud.com) users can only use 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 Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment. Update the configuration to the international site environment as follows.
|
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). |
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 place the certificate file elsewhere on the device, but ensure
com.aliyun.alivc_license.licensefile(for 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 actual file path. -
In the AndroidManifest.xml file, add a <meta-data> node.
Important-
If authentication fails, verify that <meta-data> elements are under <application> and that element names are correct. FAQ about licenses.
-
For International Website (www.alibabacloud.com) users with 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. Without ApsaraVideo Player SDK, configure only the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment.
-
You can integrate two sets of licenses: one for Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) and one for Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China). Set the player service environment each time the app starts. You cannot switch environments at runtime.

// 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. 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, or license authentication fails. For other versions and SDKs, skip 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.
-
Copy the certificate file
AliVideoCert-********.crtinto your Xcode project. Place it in the AppSupportFiles directory (recommended), 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.
Important-
For International Website (www.alibabacloud.com) users with 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. Without ApsaraVideo Player SDK, configure only the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China) environment.
-
You can integrate two sets of licenses: one for Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China)) and one for Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China). Set the player service environment each time the app starts. You cannot switch environments at runtime.
// 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. 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, or license authentication fails. For other versions and SDKs, skip 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.