MDRecordSDK
INTRODUCE
- 摄像头 SDK
在 App 中集成摄像头 SDK,可以实现摄像头功能,包括视频录制和视频编辑等。
接入环境
iOS 版本: 9.0+
导入
本 SDK 目前支持以 Pod 方式导入,同时本 SDK 包含 Base、Camera、Photo、Video 四个部分。
- Base 为基础组件,必须引用
- Camera 为视频录制模块
- Photo 为图片处理模块
- Video 为视频编辑模块
集成
在 info.plist 中添加
打开工程info.Plist,添加以下权限:
* Privacy - Media Library Usage Description
* Privacy - Camera Usage Description
* Privacy - Microphone Usage Description
* Privacy - Photo Library Additions Usage Description
* Privacy - Photo Library Usage Description
* App Transport Security Settings
在 Podfile 中添加
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
inhibit_all_warnings!
use_frameworks!
target :MDRecordSDK do
pod 'MMFrameworks', :path => './MMFramework', :subspecs => ['Eta', 'MMFoundation']
pod 'VideoSDK', :path => './VideoSDK'
pod 'MetalPetal', '1.1.2'
pod 'GPUImage', :git => 'https://github.com/NaichuanYang/GPUImage.git', :commit => '3ba128277babc67048e10c5269694aebaa8bf581'
pod 'Toast', '~> 4.0.0'
pod 'MBProgressHUD', '~> 1.1.0'
pod 'MJRefresh'
pod 'SDWebImage'
pod 'SDWebImage/WebP'
pod 'Masonry'
pod 'pop'
pod 'YYImage'
pod 'ReactiveCocoa', '2.5'
pod 'ZipArchive'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CLANG_WARN_DOCUMENTATION_COMMENTS'] = 'NO'
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
接入
- 将VideoSDK文件夹拖入工程根目录
- 将MMFramework拖入工程根目录
- 将RecordSDKUI拖入工程中
- 进入
构建阶段
,将JSONKit.m
、MDSelectedImageItem.m
、MDImagePreviewViewController
三个文件标记为fno-objc-arc
编辑方案
->运行
->选项
,将GPU帧捕获
和Metal API验证
均设置为禁用
- 进入
构建设置
,将项目
和目标
的启用位码
设置为NO
- 新建
MDPublicSwiftHeader.h
头文件,写入#import <Project_name-Swift.h>
- 新建
TestVideoFramework-Bridging-Header.h
文件,写入
#import "MDFaceTipManager.h"
#import "MDFaceTipItem.h"
#import "MDRecordingAdapter+MDAudioPitch.h"
#import "MDMusicEditPalletController.h"
#import "MDMusicCollectionItem.h"
#import "MDMusicResourceUtility.h"
#import "MDSMSelectIntervalProgressView.h"
#import "MDMusicBVO.h"
#import "MDFaceDecorationItem.h"
#import "MDFaceDecorationFileHelper.h"
#import "MDDownLoaderModel.h"
@import RecordSDK;
- 在appDelegate中调用
[[MDRecordContext faceDecorationManager] requestFaceDecorationIfNeeded];
预加载变脸素材 - 在使用VideoSDK前调用
[MDRecordManager initSDK:@"100cb616072fdc76c983460b8c2b470a"];
if ([MDRecordManager isReady]) {
[MDRecordManager registerToken];
}
MDRecordDetectorManger *detetorManager = [[MDRecordDetectorManger alloc] init];
[MDRecordManager setDetectorModelsPreloader:detetorManager];
[MDRecordDetectorProxy sharedInstance].creator = detetorManager;
初始化SDK。
- 如果遇到"@import"的问题,可以先通过在
构建设置
->其他C++标志
中,添加-fcxx-modules
解决
编译运行。
附录
接入SDK请参考: 接入文档
了解API请参考: 接口文档
版本更新历史
- [0.1.0] 第一个开发版本,主要集成Camera(视频录制)、Video(视频编辑)、Photo(图片处理)三个基本功能模块。支持多种贴纸滤镜及其它功能,如变速、合成音乐、涂鸦、视频导出等。
APPENDIX
NOTE
- 如果出现MetalPetal的filter找不到shader的错误,需要将"/Users/sunfei/Desktop/MDRecordSDK/MediaFrameworkMaker/MetalShaders"下的shaders全部复制到主工程中。
- 为了在构建设置中出现metal编译器的选项,则需要至少在工程中出现一个metal文件