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

    }

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

  • 相关阅读:
    rsync安装配置实时同步
    ORA-00392: log 4 of thread 2 is being cleared, operation not allowed
    CentOS 6.4安装配置LNMP服务器(Nginx+PHP+MySQL)
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
    常见服务端口
    linux客户端传输文件到Windows本地
    windows/Linux主机重启NetBackup服务和后台进程
    linux命令之grep命令
    linux命令之awk命令
    Shiro安全框架
  • 原文地址:https://www.cnblogs.com/timeAlove/p/4535288.html
Copyright © 2011-2022 走看看