Domain = AVFoundationErrorDomain Code = -11838 \“Operation Stopped \”UserInfo = {NSLocalizedDescription = Operation Stopped,NSLocalizedFailureReason =此媒体不支持该操作。})“)
{origin:caf lpcm,destination:aiff or wav or caf}}
以下是代码:
let composition = AVMutableComposition()
self.prepareToCombineMedia(composition)
let exportSession = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetPassthrough)!
let tmpFilePath = FileUtils.tempFile(ext: "caf")
exportSession.outputURL = NSURL.fileURL(withPath: tmpFilePath)
exportSession.outputFileType = AVFileTypeCoreAudioFormat
exportSession.exportAsynchronously {
if exportSession.status == .completed {
print("completed")
print(tmpFilePath)
subscriber.onCompleted()
} else {
subscriber.onError(LeafError.runtime(message: exportSession.error.debugDescription))
FileUtils.rm(tmpFilePath)
}
}
它只能合并到m4a或mov。我需要caf或wav或aiff文件,帮助......
答案 0 :(得分:1)
替换此行:
let exportSession = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetPassthrough)!
with:
let exportSession = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetAppleM4A)
希望它能起作用