2
從IOS8開始,我在使用commitConfiguration時遇到了一個奇怪的問題 我們通過AVCaptureMovieFileOutput記錄了5個第二個文件。更改文件時,相機預覽閃爍並淡入黑色一秒鐘。在拼接接收服務器上的文件時也會出現口吃。IOS8:當記錄到文件並使用AVCaptureSession/commitConfiguration時,相機預覽閃爍
// method that switches the output file
- (void) switchOutputFile {
NSURL *outputUrl = [self getOutputFileUrl];
NSLog(@"Switching to: %@", outputUrl);
// begin configuration
[self.captureSession beginConfiguration];
// remove the current writer
[self.captureSession removeOutput:self.fileOutput];
// attach new writer
self.fileOutput = [self attachFileWriter:self.captureSession];
// commit configuration
[self.captureSession commitConfiguration];
// after this line the camera preview flickers.
[self.fileOutput startRecordingToOutputFileURL:outputUrl recordingDelegate:self];
}