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

Environment requirements

EnvironmentDescription
iOSiOS 8.0 or later.
Development toolWe recommend that you use Xcode. The procedures described in this topic are based on a Xcode development environment. To download Xcode, visit Mac App Store.

Prerequisites

The package for ApsaraVideo Player SDK for iOS and the source code of a demo are downloaded. We recommend that you download the latest versions of the SDK and demo. For more information about the download links, see SDK overview and download.

The following table describes the folders or files in the SDK package after the package is decompressed.
Folder or fileDescription
demoThe source code of the demo for ApsaraVideo Player SDK for iOS.
docThe API references for ApsaraVideo Player SDK for iOS.
sdkThe frameworks for ApsaraVideo Player SDK for iOS. By default, only the ARM_SIMULATOR folder is provided. The ARM_SIMULATOR folder contains bitcode and simulators. If you do not want to enable bitcode or do not require simulators, run the following command to generate and download the corresponding SDK file:
cd $(SDK_PATH)   // SDK_PATH specifies the path in which the SDK file is stored.
sh createMoreKindsOfArch.sh
ReleaseNoteThe release notes for ApsaraVideo Player SDK for iOS.
The following table describes the files that are generated after you run the sh createMoreKindsOfArch.sh command.
FileDescription
ARMThe folder that contains bitcode but does not contain simulators.
ARM_NO_BITCODEThe folder that does not contain bitcode or simulators.
ARM_SIMULATORThe folder that contains bitcode and simulators.
The following table describes the framework files.
FrameworkDescription
alivcffmpeg.frameworkThe framework that serves as the underlying dependency of the player. This framework is required.
AliyunMediaDownloader.frameworkThe framework for offline download. This framework is optional.
AliyunPlayer.frameworkThe player framework. This framework is required.
artcSource.frameworkThe framework that supports the Alibaba Real-Time Communication (ARTC) protocol. This framework is optional.
artpSource.frameworkThe framework that supports the Alibaba Real-time Transport Protocol (ARTP) protocol. This framework is optional. The dependency on this framework is removed in ApsaraVideo Player SDK for iOS V5.4.5.0.
RtsSDK.frameworkThe framework that supports RTS. This framework is optional.
AlivcConanThe dependency on this framework is removed in ApsaraVideo Player SDK for iOS V5.3.0.

Usage notes

  • When you package your application files, dSYM files are used to symbolicate crash reports.
  • AlivcFFmpeg and AliyunPlayer are required when you use ApsaraVideo Player SDK for iOS. You can view header files in the directory of AliyunPlayer.framework.
  • If you want to integrate both the short video SDK and ApsaraVideo Player SDK, make sure that you import the correct version of AlivcFFmpeg. Otherwise, you cannot use the features that are provided by the short video SDK or ApsaraVideo Player SDK. For more information, see AlivcFFmpeg 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.

Integrate the SDK by using CocoaPods (Recommended)

  1. Use CocoaPods statements to integrate ApsaraVideo Player SDK for iOS. Sample code:
    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 the FFmpeg framework. This prevents conflicts with the FFmpeg framework of the short video SDK for iOS.
    ruby
      platform:ios, '8.0'
      target 'yourProject' do
        pod 'AliPlayerSDK_iOS'
       end
  2. Optional:If you want the player to support the ARTC protocol or play 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 added.
    ruby
      platform:ios, '8.0'
      target 'yourProject' do
        pod 'AliPlayerSDK_iOS', '5.4.7.1'
        pod 'AliPlayerSDK_iOS_ARTC', '5.4.7.1'
        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.RTS 
       end

Integrate the SDK by adding local files

Note If you want to integrate both the short video SDK and ApsaraVideo Player SDK, only one AlivcFFmpeg is required. Make sure that you import the correct version of AlivcFFmpeg.
  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.
    Integrate the SDK by adding local files
  3. Click the Build Settings tab.
  4. In the Search Paths section, set the Framework Search Paths parameter to the path in which the framework files are stored.

FAQ

What do I do if an error message indicating that an AlivcFFmpeg or AlivcConan conflict exists is returned when I reference a third-party SDK in my project?

The following section describes the solutions to the preceding error:
  • 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 optional for application links.
  • AlivcFFmpeg conflict: 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.

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

References

Basic features

Advanced features