zoukankan      html  css  js  c++  java
  • UIVideoEditorController 视频剪辑

    实现方法

     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];

    }

    系统自带的视频编辑  滑动框没有时间显示,没有总时长显示,也无法设置视频缩略图 ,欢迎大家探讨。

  • 相关阅读:
    带下拉子菜单的导航菜单
    如何使用myFocus插件制作焦点图效果
    将博客搬至CSDN
    《转》二进制与三进制的那些趣题
    二叉树遍历 (前序 层次 == 深度 广度) 层次遍历
    数组全排列 knuth 分解质因数
    堆排序
    双向快速排序
    二路归并排序
    字符串的排列
  • 原文地址:https://www.cnblogs.com/timeAlove/p/4535288.html
Copyright © 2011-2022 走看看