All Products
Search
Document Center

Video upload

Last Updated: Aug 01, 2019

Overview

The ApsaraVideo for VOD upload SDK plays an important role in ApsaraVideo’s mission for connecting devices through the cloud. The upload SDK allows you to conveniently upload files to ApsaraVideo for VOD and OSS. If you integrate the upload SDK, you can upload various data files including image, video, and audio files. ApsaraVideo for VOD provides multiple versions of the upload SDK, such as that for the web client (JavaScript), mobile client (Android and iOS), and server (Java). To upload files, you can also call APIs or use the Alibaba Cloud console.

Step 1: Copy SDK files

Copy the two framework files highlighted in red into your project, as shown in the following figure.Copy SDK files

Step 2: Copy business code files

Currently, the upload module is highly coupled with the editing module. To directly use the demo source code of SmartVideo, you need to integrate the import for editing module first. If you follow the procedure for integrating the import for editing module, the code of video production and upload is also integrated.

Step 3: Configure the PCH file

Add the following reference to a .pch file in your project:

  1. #import "AlivcImage.h"
  2. #import "AlivcMacro.h"

If your project does not contain a .pch file, you can copy the PrefixHeader.pch file from the demo. Keep the preceding reference in the .pch file and choose TARGETS > Build Settings to configure the PCH file, as shown in the following figure.
WX20181020-002351@2x.png
Prefix Header: Enter the directory of the PrefixHeader.pch file in your project, for example, $(SRCROOT)/Your own directory/PrefixHeader.pch.

Step 4: Set up the project environment

  • Open the project and select the target. Choose Build Settings > Linking > Other Linker Flags. Add the $(inherited) and -ObjC options.


 undefined

  • Choose Build Settings > Build Options. Set Enable Bitcode to No.


 undefined

  • Open the project and select the target. Choose General > Linked Frameworks and Libraries. Click + to add the following system library:

    1. libresolv. 9.tbd
  • Edit the Info.plist file and add the following fields to apply for the camera, album, and music access permissions:

    1. * Privacy - NSCameraUsageDescription
    2. * Privacy - NSPhotoLibraryAddUsageDescription
    3. * Privacy - NSPhotoLibraryUsageDescription
    4. * Privacy - NSAppleMusicUsageDescription

    You can also add the following code to the source code of the Info.plist file:

    1. <key>NSCameraUsageDescription</key>
    2. <string></string>
    3. <key>NSPhotoLibraryAddUsageDescription</key>
    4. <string></string>
    5. <key>NSPhotoLibraryUsageDescription</key>
    6. <string></string>
    7. <key>NSAppleMusicUsageDescription</key>
    8. <string></string>

Step 5: Use the upload feature

The upload feature is dependent on the video editing feature. After you integrate the video editing feature, the relevant code is also copied into your project. In this case, you do not need to compile the navigation code. The upload module can be triggered following the editing process. For more information about the code of the upload SDK, see the AliyunUploadViewController.m file in the following directory: demo/AliyunVideoClient_Entrance/AlivcShortVideo/AlivcShortVideoFile/VideoPublish/Control/AliyunUploadViewController.m.