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

Environment requirements

Item Requirement
iOS version 8.0 or later
Development tool We recommend that you use Xcode. The operations in this topic are based on Xcode. You can download Xcode from Mac App Store.

Prerequisites

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 the SDK of the latest version. For more information, see SDK download.

The following table describes the folders or files in the SDK folder that is generated after the SDK package is decompressed.
Folder or file Description
demo The source code of the demo for ApsaraVideo Player SDK for iOS.
doc The API reference of ApsaraVideo Player SDK for iOS.
sdk The framework library of ApsaraVideo Player SDK for iOS. By default, only the ARM_SIMULATOR folder is provided. In the ARM_SIMULATOR folder, bitcode is enabled, and simulators are included. If you do not need to enable bitcode or do not require simulators, run the following command to generate other folders:
cd $(SDK_PATH)   // The SDK_PATH variable specifies the path of the SDK.
sh createMoreKindsOfArch.sh
ReleaseNote The release notes.
The following table describes the folders in the sdk folder.
Folder Description
ARM The folder in which bitcode is enabled and simulators are not included.
ARM_NO_BITCODE The folder in which bitcode is disabled and simulator are not included.
ARM_SIMULATOR The folder in which bitcode is enabled and simulators are included.
ARM_SIMULATOR_NO_BITCODE The folder in which bitcode is disabled and simulators for the i386, x86_64, armv7, and arm64 architectures are included.
Notice The simulators are used to debug code. If you need to publish the code, do not use an SDK that contains simulators. Otherwise, the code may fail to be submitted to App Store.
The following table describes the framework files that the SDK contains.
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.
artpSource.framework The framework that supports the Alibaba Real-time Transport Protocol (ARTP). This framework is optional. The dependency on this framework has been removed in ApsaraVideo Player SDK V5.4.5.0.
RtsSDK.framework The framework that supports Real-Time Streaming (RTS). This framework is optional.
AlivcConan The dependency on this framework has been removed in ApsaraVideo Player SDK V5.3.0.
Note
  • When you package your application files, dSYM files are used to symbolicate crash reports.
  • Both the AliyunPlayer and alivcffmpeg frameworks are required. You can find header files in the AliyunPlayer.framework folder.

Integrate the SDK by using CocoaPods (Recommended)

Note If you want to integrate ApsaraVideo Player SDK for iOS and the short video SDK for iOS at the same time, replace AliPlayerSDK_iOS in the following code with AliPlayerPartSDK_iOS. AliPlayerPartSDK_iOS does not contain the FFmpeg framework. This prevents conflicts with the FFmpeg framework of the short video SDK for iOS.
  1. Integrate ApsaraVideo Player SDK for iOS by using CocoaPods statements. Sample code:
    ruby
      platform:ios, '8.0'
      target 'yourProject' do
        pod 'AliPlayerSDK_iOS'
       end
  2. Optional: If you want the player to support ARTC or RTS streams, add the pod dependencies as required. Sample code:
    Note Make sure that the version number of the SDK is correct. Otherwise, an error is reported, and the dependencies fail to be imported.
    ruby
      platform:ios, '8.0'
      target 'yourProject' do
        pod 'AliPlayerSDK_iOS', ''
        pod 'AliPlayerSDK_iOS_ARTC', ''
        pod 'RtsSDK', '2.2.0' // This version number is for reference only. For more information about the latest version of RTS SDK, see Download SDKs. 
       end

Integrate the SDK by using on-premises files

Note If your code or the third-party code that you reference conflicts with the symbol file of the alivcffmpeg or AlivcConan framework, remove alivcffmpeg or AlivcConan from Linked Frameworks and Libraries. The two frameworks are not required for application links. The dependency on AlivcConan is removed in ApsaraVideo Player SDK V5.3.0 and later.
  1. In the Xcode project, click the General tab.
  2. Add the frameworks of ApsaraVideo Player SDK for iOS to the Frameworks, Libraries, and Embedded Content section. Select Embed & Sign in the Embed column for these frameworks.
    Use on-premises files to integrate the SDK
  3. Click the Build Settings tab.
  4. In the Search Paths section, set the Framework Search Paths parameter to the path of the on-premises framework files.

FAQ

FAQ about players

Features of ApsaraVideo Player SDK for iOS

Basic features

Advanced features