MMVideoSDK相关UI接入指南
目前UI仅提供手动接入方式。
1. 手动接入
- 首先下载MMVideoSDK Demo
- 将文件夹
MMFramework
以及RecordSDKUI
拖入工程中 - 在Podfile中写入:
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/cosmos33/MMSpecs.git'
pod 'MMFrameworks', '1.0.0'
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'
pod 'JPImageresizerView'
pod 'VideoSDK', '2.1.0'
进入build phases
,标记JSONKit.m
, MDSelectedImageItem.m
, MDImagePreviewViewController
三个文件标记为-fno-objc-arc
, 然后执行pod install
.
2. 工程配置
- 在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
- 进入
EditScheme
->Run
->Options
, 更改GPU Frame Capture
以及Metal API Validation
均为Disabled
- 进入主工程
build settings
, 设置project
以及target
的Enable Bitcode
为NO
3. 调用
- (void)gotoRecord:(MDUnifiedRecordLevelType)levelType {
if (![MDCameraContainerViewController checkDevicePermission]) {
return;
}
MDCameraContainerViewController *containerVC = [[MDCameraContainerViewController alloc] init];
__weak typeof(containerVC) weakContainerVC = containerVC;
MDUnifiedRecordSettingItem *settingItem = [MDUnifiedRecordSettingItem defaultConfigForSendFeed];
settingItem.levelType = levelType;
settingItem.completeHandler = ^(id result) {
if ([result isKindOfClass:[MDRecordVideoResult class]]) {
MDRecordVideoResult *videoResult = result;
// use result to do something ...
} else if ([result isKindOfClass:[MDRecordImageResult class]]) {
MDRecordImageResult *imageResult = (MDRecordImageResult *)result;
// use result to do something ...
}
[weakContainerVC dismissViewControllerAnimated:YES completion:nil];
};
containerVC.recordSetting = settingItem;
MDNavigationController *nav = [MDNavigationController md_NavigationControllerWithRootViewController:containerVC];
[self presentViewController:nav animated:YES completion:nil];
}