美文网首页
iOS 视频保存到相册

iOS 视频保存到相册

作者: 流云_henry | 来源:发表于2019-12-20 15:06 被阅读0次
    /**
     视频保存到相册
    
     @param videoPath 视频path
     @param saveHandle 回调
     */
    -(void)saveVideoWithVideoPath:(NSString *)videoPath handle:(void(^)(BOOL,NSError *))saveHandle;
    
    
    //将视频保存到相册
    -(void)saveVideoWithVideoPath:(NSString *)videoPath handle:(void(^)(BOOL,NSError *))saveHandle{
        [[PHPhotoLibrary sharedPhotoLibrary]performChanges:^{
            //写入video到相册
            PHAssetCreationRequest *creationRequest = [PHAssetCreationRequest creationRequestForAsset];
            PHAssetResourceCreationOptions *options = [[PHAssetResourceCreationOptions alloc] init];
            [creationRequest addResourceWithType:PHAssetResourceTypeVideo fileURL:[NSURL fileURLWithPath:videoPath] options:options];
            
        } completionHandler:^(BOOL success, NSError * _Nullable error) {
            saveHandle(success,error);
        }];
    }
    

    相关文章

      网友评论

          本文标题:iOS 视频保存到相册

          本文链接:https://www.haomeiwen.com/subject/hfkinctx.html