All Products
Search
Document Center

ApsaraVideo VOD:Quick integration

Last Updated:Apr 14, 2025

This topic describes how to integrate ApsaraVideo Player SDK for iOS.

Environment requirements

  • Systems: iOS 8.0 and later versions are supported.

  • Development tools: We recommend that you use Xcode. The procedures described in this topic are based on Xcode. Download URL: ‎Xcode.

Before you begin

  • You have registered and obtained a license file AliVideoCert-********.crt that contains the player authorization. For more information, see Obtain a license.

  • The ApsaraVideo Player SDK for iOS package is downloaded before you integrate the SDK by using on-premises files. The SDK package contains ApsaraVideo Player SDK for iOS and the source code of a demo. We recommend that you download and use the latest version. For more information about the download URL, see ApsaraVideo Player SDK.

Notes

  • When you package the application, the dSYM file is used to parse the crash symbol table.

  • AlivcFFmpeg and AliyunPlayer are required when you use ApsaraVideo Player SDK for iOS. You can find header files in the directory of AliyunPlayer.

  • If you want to integrate both the short video SDK and ApsaraVideo Player SDK, you must pay attention to the version dependencies among the short video SDK, ApsaraVideo Player SDK, and AlivcFFmpeg. Otherwise, features of the short video SDK or ApsaraVideo Player SDK may fail to be used. For more information, see AlivcFFmpeg version dependencies.

  • Specific features of ApsaraVideo Player SDK for iOS may not run as expected on a simulator. After you integrate ApsaraVideo Player SDK for iOS, we recommend that you use an iPhone for debugging.

  • A simulator is included in the installation package of ApsaraVideo Player SDK for iOS. You can use the simulator to debug code. If you want to publish the application, do not use SDKs that contain simulators. Otherwise, the application may fail to be submitted to App Store.

SDK integration (CocoaPods integration) (recommended)

  • Use the pod statement to integrate ApsaraVideo Player SDK and Real-Time Streaming (RTS) SDK (optional). The following code provides an example:

    Note
    • If you want to integrate both the short video SDK and ApsaraVideo Player SDK, replace AliPlayerSDK_iOS in the following code with AliPlayerPartSDK_iOS. AliPlayerPartSDK_iOS does not contain FFmpeg, which prevents conflicts with FFmpeg in the short video SDK.

    • Make sure that the version number of the SDK is correct. Otherwise, an error will be reported and the dependencies will fail to be added.

    ruby
      platform:ios, '8.0'
    
      player_sdk_version = '7.2.0'
    
      target 'yourProject' do
          # ApsaraVideo Player SDK. We recommend that you use the latest version. For more information, visit the official website: https://help.aliyun.com/zh/vod/developer-reference/sdk-overview-and-download?spm=a2c4g.11186623.0.0.63cde7ea3nNYgA#section-v53-2oj-xfd.
          pod 'AliPlayerSDK_iOS' , player_sdk_version
       end

SDK integration (local integration)

Note

If you want to integrate both the short video SDK and ApsaraVideo Player SDK, only one AlivcFFmpeg is required. Make sure to import the correct version of AlivcFFmpeg.

  1. In the Xcode project, click the General tab.

  2. Add the framework of the SDK to Frameworks, Libraries, And Embedded Content and set Embed to Embed & Sign.

    本地集成

  3. Click the Build Settings tab.

  4. Click Framework Search Paths in the Search Paths section and modify the path to the directory where the local framework is stored.

Rts integration (CocoaPods integration) (optional)

If you need to integrate the RTS component, see Implement RTS stream pulling on iOS.

Bind a license to an iOS application

  1. Configure a license.

    1. Recommended. Copy the license file AliVideoCert-********.crt to the AppSupportFiles directory of your Xcode project. You can also copy it to the sandbox directory or other directories that you prefer. Select the current project in Target Membership.

      p687320

    2. Open the Info.plist file. Set the AlivcLicenseKey and AlivcLicenseFile parameters for the China environment, or the AlivcLicenseKey_SEA and AlivcLicenseFile_SEA parameters for the international environment to the license key and license file path you obtained when applying for the license.

      Important
      • To use Player SDK V6.14.0 or later on the Alibaba Cloud international site (alibabacloud.com), you must configure a license specifically for the international environment. If Player SDK is not used, you can configure a license for the China environment.

      • You can bind two licenses to your application at the same time: one for the China environment and the other for the international environment. When starting your application, you can specify which environment the player should use by configuring the service environment for Player SDK. The environment cannot be changed while the player is running.

      // Configure a license for the China environment. This is the default configuration.
      <key>AlivcLicenseFile</key>
      <string>XXX</string>
      <key>AlivcLicenseKey</key>
      <string>foIVziMaUHaRqgDyhf6b6eb8fcf014af39535d0720a32****</string>
      
      
      // Configure a license for the international environment and manually add _SEA to the end.
      <key>AlivcLicenseFile_SEA</key>
      <string>XXX</string>
      <key>AlivcLicenseKey_SEA</key>
      <string>f6b6efoIVziMaUHaRqgDyhb8fcf014af39535d0a32072****</string>
  2. Configure a service environment for Player SDK if you want to use the international environment.

    Beginning with Player SDK V6.14.0, you can select a service environment, with the default configuration set to the China environment. To switch to the international environment, you must update the service environment to international by using the following method each time you start your application. Failure to do so will result in authentication failures for the license that authorizes your application to use Player SDK. This step is unnecessary if you are using Player SDK versions earlier than V6.14.0 or other SDKs.

    // Before using the international environment, make sure that you have updated the service environment to international prior to calling any player API operations. This ensures that all subsequent services will run on the Alibaba Cloud international site (alibabacloud.com).
    // Update the service environment to international by calling the following operation. The environment cannot be changed while the player is running.
    AlivcBase.EnvironmentManager.globalEnvironment = ENV_SEA;

Project structure

Framework

Description

alivcffmpeg.framework

The framework that serves as the underlying dependency of the player. This framework is required.

AliyunMediaDownloader.framework

The framework for offline download. This framework is optional.

AliyunPlayer.framework

The player framework. This framework is required.

artcSource.framework

The framework that supports the Alibaba Real-Time Communication (ARTC) protocol. This framework is optional.

Note

If you want to support the ARTC protocol, you must also add RtsSDK.framework. For more information about the integration procedure, see Implement RTS stream pulling on iOS.

aemFilter.framework

The framework for audio enhancement. This framework is optional.

libPluginSR.framework

The framework for super-resolution model. This framework is optional.

normalsrFilter.framework

The framework for super-resolution model. This framework is optional.

mpfFilter.framework

The framework for super-resolution model. This framework is optional.

srFilter.framework

The framework for super-resolution model. This framework is optional.

vfiFilter.framework

The framework for video frame insertion. This framework is optional.

FAQ

Your code or the third-party code that you reference reports a conflict with the symbol of AlivcFFmpeg during integration

Solutions:

  • Conflict with symbol of AlivcFFmpeg: Retain only one AlivcFFmpeg and delete the extra AlivcFFmpeg dependencies. AlivcFFmpeg is a custom dependency developed by Alibaba Cloud based on FFmpeg and a key part of ApsaraVideo Player SDK. We recommend that you delete the AlivcFFmpeg dependency for the third-party SDK and retain the AlivcFFmpeg dependency for ApsaraVideo Player SDK. This may cause errors in the third-party player.

Sandbox error

  • The following section describes the error:

    截屏2024-12-06 16

  • Solutions:

    Set User Script SandBoxing in UserSetting to NO.

    1735888658101-5633103e-468d-4341-adaa-f5f52814aa36

Short video SDK integration

If you want to integrate both ApsaraVideo Player SDK for iOS and the short video SDK into your project, we recommend that you use the all-in-one SDK for iOS for integration. Otherwise, duplicate classes may cause compilation failures.

For more information about the issues that may occur when you use ApsaraVideo Player SDK and the solutions to these issues, see Player issues.

References

Basic features

Advanced features