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

    }

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

  • 相关阅读:
    mysql如何查询最新插入的数据
    nodejs express开发
    在线考试实现倒计时的代码
    centos的vsftp修改上传下载速度
    centos vsftpd
    ul和li里面的list-style
    算法竞赛入门经典 暴力求解法 7.1简单枚举 最大乘积
    算法竞赛入门经典 暴力求解法 7.1简单枚举 最大乘积
    算法竞赛入门经典 暴力求解法 7.1简单枚举 除法
    算法竞赛入门经典 暴力求解法 7.1简单枚举 除法
  • 原文地址:https://www.cnblogs.com/timeAlove/p/4535288.html
Copyright © 2011-2022 走看看