All Products
Search
Document Center

Apsara Video SDK:Integrate a license

Last Updated:Jun 04, 2026

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

image

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
  1. Permission changes usually include activating services, enabling value-added services, or renewals.

  2. Native ApsaraVideo Player SDK V7.6.0 and later require a license file.

  3. The web client does not require a license file.

  4. For renewals, the certificate updates online automatically, but update the local file to ensure validity checks succeed.

To skip the built-in license file, omit the LicenseFile configuration in the platform-specific steps below.

Note

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

  1. Obtain the License Key from the console.

  2. 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
      }
    });
  3. If no error messages appear after initialization, the license is configured successfully.

    Note

    The page domain must match or be a subdomain of the domain registered in your license application. Otherwise, verification fails.

Integrate a license on Android

  1. Configure the license.

    1. (Recommended) Copy the certificate file to the assets directory in your Android Studio project.

      Note

      You 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)) or com.aliyun.alivc_license.licensefile_SEA (for Global (excluding the Chinese mainland, Hong Kong (China), Macao (China), and Taiwan (China))) matches the actual file path.

    2. 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.

      Android license configuration

      // 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. -->
  2. 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.

    1. 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);
    2. Method 2 (Recommended): For ApsaraVideo Player SDK V7.6.0 and later, configure the international site environment using the XML method.

      In the AndroidManifest.xml file, add a <meta-data> node.

      <meta-data
        android:name="com.aliyun.alivc_env"
        android:value="SEA"/>  

      The following figure shows a configuration example:1754556751170-7001527b-36a7-4ebd-8887-e0972a3d64e3

Integrate a license on iOS

  1. Configure the license.

    1. Copy the certificate file AliVideoCert-********.crt into your Xcode project. Place it in the AppSupportFiles directory (recommended), the sandbox, or another path. In Target Membership, select the current project.

      p687320

    2. 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>
  2. 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.

    1. 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;
    2. Method 2 (Recommended): For ApsaraVideo Player SDK V7.6.0 and later, configure the international site environment using the Info.Plist method.

      Open the Info.plist file and set AlivcEnv to SEA.

      // Configure the current environment as the international site environment.
      <key>AlivcEnv</key>
      <string>SEA</string>

      The following figure shows a configuration example:1754557498401-1d235342-3c0b-4c83-bcee-ae7656e8ff23

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.