实现方法
if ( [UIVideoEditorController canEditVideoAtPath:self.video.filePath])
{
//YSXVideoEditorViewController : UIVideoEditorController
/*
@property(nonatomic, copy) NSString *videoPath;
@property(nonatomic) NSTimeInterval videoMaximumDuration; // default value is 10 minutes. set to 0 to specify no maximum duration.
@property(nonatomic) UIImagePickerControllerQualityType videoQuality;
*/
_videoEditViewC = [[YSXVideoEditorViewController alloc] init];
//扩展属性
_videoEditViewC.video = self.video;
//视频最大时长
//_videoEditViewC.videoMaximumDuration ;
_videoEditViewC.videoPath = self.video.filePath;
//设置代理 退出编辑
_videoEditViewC.delegate = self;
[self presentViewController:_videoEditViewC animated:YES completion:nil];
}
代理回调
- (void)videoEditorController:(UIVideoEditorController *)editor didFailWithError:(NSError *)error
{
YSXLOGINFO(@"%@",error);
[editor dismissViewControllerAnimated:YES completion:nil];
}
- (void)videoEditorControllerDidCancel:(UIVideoEditorController *)editor
{
YSXLOGINFO(@"Cacel");
[editor dismissViewControllerAnimated:YES completion:nil];
}
- (void)videoEditorController:(UIVideoEditorController *)editor didSaveEditedVideoToPath:(NSString *)editedVideoPath{
YSXLOGINFO(@"didSaveEditedVideo");
YSXLOGINFO(@"%@ -- %@",editedVideoPath,editor);
//判断是否有重复的文件
NSString * MD5 = self.video.MD5;
NSString *path = self.video.filePath;
//删除原有视频
[[YSXFileManager shareFileManager] deleteVideo:self.video];
//移动
[[NSFileManager defaultManager] moveItemAtPath:editedVideoPath toPath:path error:nil];
//创建新的视频
[[YSXFileManager shareFileManager] addVideoToConfigPlist:path
md5:MD5
metaData:nil
manual:YES];
RecPlayVideoEntity *video = [[RecPlayShareVideo shareInstance] getLastRecordingVideo];
self.video = video;
[editor dismissViewControllerAnimated:YES completion:nil];
}
系统自带的视频编辑 滑动框没有时间显示,没有总时长显示,也无法设置视频缩略图 ,欢迎大家探讨。