All Products
Search
Document Center

ApsaraVideo VOD:Integrate the short video SDK for iOS

Last Updated:Jan 03, 2024

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 lists the requirements for 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 dependencies to the Podfile file.

    Important
    • If you use the short video SDK 3.24.0 or later, use FFmpeg 4.3.0 or later.

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

    • If you integrate the short video SDK by using the least dependency integration method, you must integrate the upload SDK if media upload is required. For more information, see Integrate the upload SDK for iOS.

    • Default integration (the resource package and upload SDK included)

      # The resource package, upload SDK, and short video SDK are integrated. This is the default integration method. 
      pod 'AliyunVideoSDKPro', '~> 6.7.0'
    • Least dependency integration (the resource package and upload SDK excluded)

      # Only the short video SDK is integrated. The resource package and upload SDK are not integrated.
      pod 'AliyunVideoSDKPro/min', '~> 6.7.0'
      Note

      You must add the AliyunVideoSDKPro.bundle resource package if you want to use face stickers during recording. For more information, see Specify the resource package path.

  2. Update the pod repository.

    pod repo update
  3. Install the pod.

    pod install

Manually integrate the SDK

Description of framework and resource dependencies

Note

The upload framework is not supported for manual integration. You must integrate the upload SDK to upload media files to ApsaraVideo VOD. For more information, see Integrate the upload SDK for iOS.

The following table describes the frameworks and resource packages required for manual integration.

Name

Description

Download link

AliyunVideoSDKPro.framework

Dynamic framework

Professional Edition V6.7.0

AliyunVideoSDKPro.bundle

Resource package (optional)

Note

This resource package is required if you want to use face stickers during recording.

alivcffmpeg

Dynamic framework

GitHub

Procedure

Note
  • The procedure for manual integration is complex. 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. We recommend that you integrate the short video SDK in pod mode. You can use the following methods to strip the dynamic frameworks:

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

  • 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++.

  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 the preceding dynamic frameworks AliyunVideoSDKPro.framework and alivcffmpeg.framework. After the frameworks are imported, click Embed & Sign.

  2. Add other libraries.

    Click the General tab. In the Frameworks, Libraries, and Embedded Content section, click + and import MobileCoreServices.framework, SystemConfiguration.framework, and libresolv.tbd.

  3. Optional. Import the AliyunVideoSDKPro.bundle resource package to your project.

    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.

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. 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 a license, 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 Android.