All Products
Search
Document Center

Video recording

Last Updated: Apr 03, 2020

Overview

The recording module of the Alibaba Cloud short video SDK provides the video recording feature. When you record videos, you can use features such as filters, music, speed control, basic and advanced face filters, and facial motion graphics.

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 | | AlivcRecord | The code for configuring the recording 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 'AlivcRecord', :path => 'AlivcRecord/'
    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 - Camera Usage Description
    • Privacy - Microphone Usage Description
    • Privacy - Photo Library Usage Description
    • Privacy - Photo Library Additions Usage Description
    • Privacy - Media Library Usage Description

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

  1. <key>NSAppleMusicUsageDescription</key>
  2. <string></string>
  3. <key>NSPhotoLibraryAddUsageDescription</key>
  4. <string></string>
  5. <key>NSPhotoLibraryUsageDescription</key>
  6. <string></string>
  7. <key>NSMicrophoneUsageDescription</key>
  8. <string></string>
  9. <key>NSCameraUsageDescription</key>
  10. <string></string>
  11. <key>NSAppTransportSecurity</key>
  12. <dict>
  13. <key>NSAllowsArbitraryLoads</key>
  14. <true/>
  15. </dict>

Step 4. Use the feature

Go to the AliyunRecordParamViewController controller to check the result of the preceding configuration.Take a new project as an example. Run the #import "AliyunRecordParamViewController.h" command to import the header file of the controller to the SceneDelegate.m file, and then specify AliyunRecordParamViewController 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. AliyunRecordParamViewController *vc = [[AliyunRecordParamViewController alloc]init];
  8. UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
  9. nav.navigationBar.hidden = YES;
  10. self.window.rootViewController = nav;
  11. [self.window makeKeyAndVisible];
  12. }

Run the project on a mobile phone to use the recording feature.