【发布时间】:2014-02-11 11:12:10
【问题描述】:
我正在将两个录音(使用AVAudioRecorder 录制)合并到一个文件中。使用AVAssetExportSession 导出组合文件第一次完美运行(即,只要我在当前视图控制器中)
但是当再次加载这个视图(新会话)时,AVAssetExportSession exportAsynchronouslyWithCompletionHandler: 方法根本不会被调用(没有回调!)
没有错误没有什么...
我试图记录 AVAssetExportSession 对象,我第一次得到这个
<AVAssetExportSession: 0x155b3250, asset = <AVMutableComposition: 0x156474c0 tracks = ("<AVMutableCompositionTrack: 0x156a0bb0 trackID = 1, mediaType = soun, editCount = 0>")>, presetName = AVAssetExportPresetAppleM4A, outputFileType = (null)
这是第二次
<AVAssetExportSession: 0x1559e840, asset = <AVMutableComposition: 0x155f7f30 tracks = ("<AVMutableCompositionTrack: 0x155f0120 trackID = 1, mediaType = soun, editCount = 1>")>, presetName = AVAssetExportPresetAppleM4A, outputFileType = (null)
我注意到的唯一区别是 editCount = 1 东西。
我知道这听起来令人困惑,对我来说是这样。这是怎么回事?
我的代码:
AVAssetExportSession* exportSession = [AVAssetExportSession
exportSessionWithAsset:composition
presetName:AVAssetExportPresetAppleM4A];
NSLog(@"exportSession: %@", exportSession);
exportSession.outputURL = [NSURL fileURLWithPath:combined];
exportSession.outputFileType = AVFileTypeAppleM4A;
exportSession.shouldOptimizeForNetworkUse = YES;
[exportSession exportAsynchronouslyWithCompletionHandler:^{
switch (exportSession.status) {
case AVAssetExportSessionStatusFailed:
NSLog(@"AVAssetExportSessionStatusFailed");
break;
case AVAssetExportSessionStatusCompleted:
NSLog(@"AVAssetExportSessionStatusCompleted");
break;
case AVAssetExportSessionStatusWaiting:
NSLog(@"AVAssetExportSessionStatusWaiting");
break;
default:
break;
}
dispatch_async(dispatch_get_main_queue(), ^{
[self exportDidFinish:exportSession];
});
}];
【问题讨论】:
-
你有没有弄清楚 editCount 是什么?
标签: ios avaudiorecorder avassetexportsession