标签:relative default ati 本地 沙盒 network 相册 res pre
1, exportSession
let option = PHVideoRequestOptions() option.isNetworkAccessAllowed = true option.deliveryMode = .highQualityFormat PHCachingImageManager.default().requestExportSession(forVideo: asset, options: option, exportPreset: AVAssetExportPresetHighestQuality) { (exportSession, info) in guard let exportSession = exportSession else { single(.error(KimPhotoHelperError.sourceNotFound)) return } exportSession.outputURL = videoPath exportSession.outputFileType = .mp4 exportSession.exportAsynchronously { switch exportSession.status { case .completed: single(.success((videoPath.relativePath, size))) case .failed: print(exportSession.error) single(.error(KimPhotoHelperError.sourceNotFound)) default: break } } }
2, PHAssetResourceManager
let resourceManager = PHAssetResourceManager.default() let option = PHAssetResourceRequestOptions() option.isNetworkAccessAllowed = true resourceManager.writeData(for: assetRescource, toFile: videoPath, options: option) { (error) in guard let error = error else { //single(.error(e)) exportSession(asset) return } single(.success((videoPath.relativePath, size))) }
标签:relative default ati 本地 沙盒 network 相册 res pre
原文地址:https://www.cnblogs.com/daxueshan/p/12808761.html