This topic describes how to integrate the short video SDK for iOS in pod mode and manually integrate the SDK.

Prerequisites

The development environment is set up. The following table describes the development environment.
Environment Description
iOS iOS 9.0 or later.
macOS High Sierra macOS High Sierra 10.13 or later.
Xcode Xcode 9.0 or later. Visit Mac App Store to download Xcode.

(Recommended) Integrate the SDK in pod mode

Procedure

  1. Add the dependency to the Podfile file.
    Notice If you use the short video SDK 3.24.0 or later, use FFmpeg 4.3.0 or later.
    pod 'AliyunVideoSDKPro', '~> 3.32.0'
  2. Update the pod repository.
    pod repo update
  3. Install the pods.
    pod install
Note Make sure that you can access and update the pod repository over the network. After the pods are installed, check whether the framework version is the same as the latest version that is released on the GitHub official website.

Manually integrate the SDK

To manually integrate the SDK, download the latest release packages from GitHub. To follow the examples in this topic, you need to download six frameworks and a bundle resource package.
Name Type Description Download link
AliyunVideoSDKPro Static framework Short video SDK Professional Edition
AliyunVideoAIO Dynamic framework Short video SDK Professional Edition
AliyunVideoSDKPro.bundle Resource package Short video SDK Professional Edition
alivcffmpeg Dynamic framework FFmpeg framework GitHub
AlivcConan Dynamic framework Tool framework GitHub
VODUpload Static framework Upload framework of ApsaraVideo VOD GitHub
AliyunOSSiOS Static framework OSS upload framework GitHub

Procedure

Notice
  1. To import dynamic frameworks, perform the following operations: In the left-side navigation pane, click TARGETS. On the page that appears, click the General tab. In the Frameworks, Libraries, and Embedded Content section, import the frameworks.
  2. Before you submit dynamic frameworks to App Store, you must strip dynamic frameworks of the x86-based simulator architecture. If you do not strip the dynamic frameworks, your submission will be rejected by the App Store. You can strip dynamic frameworks of the x86-based simulator architecture by using one of the following methods:
    • Use the lipo command-line tool to strip dynamic frameworks of the x86-based simulator architecture.
    • Integrate dynamic frameworks in pod mode. This way, dynamic frameworks of the x86-based simulator architecture are automatically stripped when the pods are packaged.
  1. Add dynamic frameworks.
    Click the General tab. In the Frameworks, Libraries, and Embedded Content section, click +, select Add Other... from the drop-down list, and then import AliyunVideoAIO.framework, AlivcConan.framework, and alivcffmpeg.framework. After the frameworks are imported, click Embed & Sign.
  2. Add static frameworks.
    Click the General tab. In the Frameworks, Libraries, and Embedded Content section, click +, select Add Other... from the drop-down list, and then import AliyunVideoSDKPro.framework, AliyunOSSiOS.framework, and VODUpload.framework.
  3. Add other dependencies.
    Click the General tab. In the Frameworks, Libraries, and Embedded Content section, click + and import MobileCoreServices.framework, SystemConfiguration.framework, and libresolv.tbd.
  4. Import AliyunVideoSDKPro.bundle to the project. This step is required only if you use the SDK Professional Edition. You can skip this step if you use the SDK Basic or Standard Edition.
    Click the Build Phases tab. In the Copy Bundle Resources section, click +, select Add Other… from the drop-down list, and then import AliyunVideoSDKPro.bundle.
Note

The manual integration of the SDK is complex and requires you to strip dynamic frameworks before you submit dynamic frameworks to App Store. We recommend that you integrate the SDK in pod mode.

If an error occurs during compilation, perform the following operations: Click the Build Settings tab. In the Apple Clang - Language section, set Compile Sources As to Objective-C++.

Configure the project

After the SDK is integrated, open the project and modify the configurations.

  1. Click the Build Settings tab. In the Linking section, set Other Linker Flags to -ObjC.
  2. Click the Build Settings tab. In the Build Options section, set Enable Bitcde to NO.
  3. Open the info.Plist file of the project and grant the following permissions:
    Privacy - Camera Usage Description
    Privacy - Microphone Usage Description
    Privacy - Photo Library Usage Description

Configure the license file

After you obtain the license, configure the license file. For more information about how to obtain licenses, see Obtain and use a license of the short video SDK.

Import the downloaded license file into the application project. Add AlivcLicenseKey and AlivcLicenseFile to the info.Plist file. The value of AlivcLicenseKey is the value of LicenseKey, and the value of AlivcLicenseFile is the directory in which the license file is stored. The following table describes the keys required in the configuration.
key value
AlivcLicenseKey The value of LicenseKey. Example: MoCTfuQ391Z01mNqG8f8745e23c8a457a8ff8d5faedc1****.
AlivcLicenseFile The directory in which the license file is stored.

References

For more information about API operations, see API references.

For more information about what to do next, see Initialize the short video SDK for iOS.