全部产品
云市场

视频录制

更新时间:2020-02-13 20:07:23

简介

阿里云短视频SDK录制模块提供了视频录制的能力,具备滤镜、音乐和变速、高级美颜和美肌、普通美颜、人脸动图等能力。

步骤1、文件拷贝

  • 拷贝以下组件到与自己工程文件xxx.xcodeproj的同级目录下。
文件 描述 是否可选
AlivcConmmon 公用组件 必须
AlivcCore 短视频公用组件 必须
AlivcRecord 短视频录制组件 必须

步骤2、配置Pod

  • 拷贝以下pod配置到你的PodFile配置文件(如果没有PodFile,在控制台cd到工程根目录并执行pod init即可)

    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'

控制台cd到工程中的PodFile目录下,执行:

  1. pod install

步骤3、工程设置

  1. 配置 Build Setting -- Build Options -- Enable Bitcode 选项为NO
  2. 配置info.Plist文件。

    打开工程的 info.Plist 文件,添加如下字段:

    • Privacy - Camera Usage Description
    • Privacy - Microphone Usage Description
    • Privacy - Photo Library Usage Description
    • Privacy - Photo Library Additions Usage Description
    • Privacy - Media Library Usage Description

    也可以把info.plist以SourceCode的形式打开,添加以下字符:

    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>

步骤4、简单使用

您只需要跳转到名称为:AliyunRecordParamViewController的控制器即可查看到效果。这里以一个新建的工程为例,在SceneDelegate.m中,引入头文件#import "AliyunRecordParamViewController.h",然后设置根视图控制器为AliyunRecordParamViewController即可。代码示例:

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

之后连接手机真机运行即可体验录制功能。