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

    }

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

  • 相关阅读:
    2020软件工程作业01
    2020软件工程—06—个人作业
    团队二次作业
    软件工程作业05
    软件工程作业00--问题清单
    软件工程作业04二期
    2020软件工程作业04
    oracle11安装过程中常出现的问题和解决办法
    2020软件工程作业03
    2020软件工程作业02
  • 原文地址:https://www.cnblogs.com/timeAlove/p/4535288.html
Copyright © 2020-2023  润新知