iOS开发笔记-100:Swift5 - 保存本地视频

//保存本地视频
        let videoCompatible = UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(str)
        //判断是否可以保存
        if videoCompatible {
            UISaveVideoAtPathToSavedPhotosAlbum(str, self, #selector(didFinishSavingVideo(videoPath:error:contextInfo:)), nil)
        } else {
            JJHUDManage.show("该视频无法保存至相册")
        }
@objc func didFinishSavingVideo(videoPath: String, error: NSError?, contextInfo: UnsafeMutableRawPointer?) {

        if error != nil{
            JJHUDManage.errorShow("保存失败")
            JJLog(error?.localizedDescription)
        }else{
            JJHUDManage.successShow("保存成功")
        }
    }

你可能感兴趣的:(iOS开发笔记-100:Swift5 - 保存本地视频)