我想保存AVAsset
中使用远程URL
初始化的视频。我尝试使用this解决方案,但我仍然收到错误:
错误Domain = AVFoundationErrorDomain 代码= -11838“操作已停止” UserInfo = {NSLocalizedFailureReason =不支持该操作 这个媒体。,NSLocalizedDescription =操作已停止, NSUnderlyingError = 0x1c424d3b0 {错误域= NSOSStatusErrorDomain 代码= -12109“(null)”}}
这就是我出口资产的方式:
let exporter = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetHighestQuality)
let filename = UUID().uuidString
let documentDirectory = documentDirectory()
let outputURL = documentDirectory.appendingPathComponent(filename)
exporter?.outputURL = outputURL
exporter?.outputFileType = .mp4
exporter?.exportAsynchronously {
print(exporter?.error)
}
当AVAsset
加载了值时,我正在这样做(根据上面提到的帖子):
asset.loadValuesAsynchronously(forKeys: ["tracks"]) {
// export here
}