All Products
Search
Document Center

Import for editing

Last Updated: Apr 03, 2020

Overview

The editing module of the Alibaba Cloud short video SDK allows you to edit video effects. When you edit videos, you can use features such as filters, music, motion graphics, subtitling, music videos (MVs), sound effects, video effects, speed control, transition, and graffiti. You can quickly integrate the professional video editing feature into your application in a few simple steps. You can use a configuration file to customize the style of the video editing UI. You can also refer to the demo and use the Alibaba Cloud short video SDK to customize your own editing module.

Step 1. Copy files

  • Copy the components listed in the following table to the directory where the xxx.xcodeproj file resides.

    | Component | Description | Required | | —————— | ————- | ————————- | | AlivcConmmon | The public components. | Yes | | AlivcCore | The public components of the short video SDK. | Yes | | AlivcEdit | The code for configuring the editing UI. | Yes |

Step 2. Integrate CocoaPods

  • Add the following CocoaPods configuration to the PodFile. If the PodFile does not exist, run the cd command in Xcode to go to the root directory of your project, and then run the pod init command.

    1. pod 'AlivcCommon', :path => 'AlivcCommon/'
    2. pod 'AlivcCore', :path => 'AlivcCore/'
    3. pod 'AlivcEdit', :path => 'AlivcEdit/'
    4. pod 'VODUpload', :git => 'https://github.com/aliyunvideo/VODUpload.git',:tag => '1.5.3'
    5. pod 'QuCore-ThirdParty',:git => 'https://github.com/aliyunvideo/QuCore-ThirdParty.git',:tag => '3.10.0'
    6. pod 'AliyunVideoSDKPro',:git => 'https://github.com/aliyunvideo/AliyunVideoSDKPro.git',:tag => '3.14.0'
    7. pod 'AlivcConan',:git => 'https://github.com/aliyunvideo/AlivcConanSDK.git',:tag => '1.0.2'
    8. pod 'AliyunRace',:git => 'https://github.com/aliyunvideo/AliyunRace.git',:tag => '1.0.0'

Run the cd command to go to the directory of the PodFile in your project, and then run the following command:

  1. pod install

Step 3. Configure the project

  1. On the Build Setting page, set Enable Bitcode to No in the Build Options section.

  2. Configure the Info.plist file.

    Open the Info.plist file of your project and add the following fields:

    • Privacy - Photo Library Usage Description
    • Privacy - Photo Library Additions Usage Description

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

  1. <key>NSPhotoLibraryAddUsageDescription</key>
  2. <string></string>
  3. <key>NSPhotoLibraryUsageDescription</key>
  4. <string></string>

Step 4. Use the feature

Go to the AliyunConfigureViewController controller to check the result of the preceding configuration.Take a new project as an example. Run the #import "AliyunConfigureViewController.h" command to import the header file of the controller to the SceneDelegate.m file, and then specify AliyunConfigureViewController as the root view controller. The sample code is as follows:

  1. - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
  2. // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
  3. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
  4. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
  5. UIWindowScene *windowScene = (UIWindowScene *)scene;
  6. self.window = [[UIWindow alloc]initWithWindowScene:windowScene];
  7. AliyunConfigureViewController *vc = [[AliyunConfigureViewController alloc]init];
  8. vc.isClipConfig = @"NO";
  9. UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
  10. nav.navigationBar.hidden = YES;
  11. self.window.rootViewController = nav;
  12. [self.window makeKeyAndVisible];
  13. }

Run the project on a mobile phone to use the editing feature.The editing page is as shown in the following figure.editNote: To publish a video after you edit it, you must integrate the playback module. Otherwise, you cannot go to the next step after editing the video.If you only need the editing module and do not want to play videos, change the value of the macro definition kAlivcProductType to AlivcOutputProductTypeShortVideo in the AlivcMacro.h file.