我用in.UIApplicationDidEnterBackgroundNotification AVAssetWriter AVCaptureSession来记录video.it工作得很好,当应用程序转到后台或调用来了UIApplicationDidEnterBackgroundNotification工作在CTCallCenter.callEventHandler中,AVAssetWriter finishWriting返回NO时,使用UIApplicationDidEnterBackgroundNotification和CTCallCenter.callEventHandler停止记录。以下是AVAssetWriter.error:
错误Domain=AVFoundationErrorDomain代码=-11800 "这项操作无法完成“UserInfo=0x6c0bc20 {NSLocalizedFailureReason=发生未知错误(-12785),NSUnderlyingError=0x6c0fc80”操作无法完成。(OSStatus错误-12785.)",NSLocalizedDescription=这项操作无法完成}
似乎AVAssetWriter立即失败时,一个电话coming.The记录文件还没有完成,不能是played.Can,有人告诉我如何处理它?
CTCallCenter代码:
m_callCenter = [[CTCallCenter alloc] init];
m_callCenter.callEventHandler= ^(CTCall* call)
{
if (call.callState == CTCallStateDialing || call.callState == CTCallStateIncoming){
[self stopRecording];
//[self performSelectorOnMainThread:@selector(stopRecording) withObject:nil waitUntilDone:NO];
}
};在其他情况下,stopRecording工作得很好。
发布于 2012-04-28 22:58:02
电话会导致AudioSession中断,所以如果您使用AudioSession回调,您可能很快就会发现。虽然我怀疑你的AVAssetWriter可能在这一点上已经被烧坏了。
设置AVAssetWriter.movieFragmentInterval应该有助于最小化您的损失-来自AVAssetWriter.h:
当使用电影片段时,可以成功地打开写入意外中断的部分写入资产,并将其播放到指定时间间隔的倍数。
https://stackoverflow.com/questions/10361551
复制相似问题