我正在使用
保存视频文件PHPhotoLibrary.shared().performChanges({
let request = PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: (videoUrl)!)
videoAssetPlaceholder = request!.placeholderForCreatedAsset
}, completionHandler: { success, error in ... ETC ETC
当视频被保存时..当我从OSX打开IMAGECAPTURE应用程序以查看所有“相机胶卷”文件时,该视频的名称很有趣。
这是怎么回事?如果将视频导出到我的桌面,它将保留该怪异名称。奇怪的是..如果我使用经过重新创建的资产中的localIdentifier再次使用
从“相机胶卷”中检索到该资产 let localID = videoAssetPlaceholder.localIdentifier
guard let asset = PHAsset.fetchAssets(withLocalIdentifiers: [localID], options: .none ).firstObject else {
return
}
var filename:String?
PHImageManager.default().requestAVAsset(forVideo: asset, options: nil, resultHandler: { (vasset, audiomix, icon) in
filename = (vasset as! AVURLAsset).url.absoluteString
})
它打印:file:///var/mobile/Media/DCIM/106APPLE/IMG_6572.MP4