我正在使用 AVCaptureView 录制视频,并且在第一次按下录制按钮时一切正常。能够录制视频并在录制结束后将其保存在磁盘上。但此时,我无法重新开始第二次录制。录制按钮显示为停止录制按钮(而不是开始录制)。代码非常简单
- (void)captureView:(AVCaptureView *)captureView startRecordingToFileOutput:(AVCaptureFileOutput *)fileOutput {
NSLog(@"started recording");
[VideoCaptureView.fileOutput startRecordingToOutputFileURL:_outputURL recordingDelegate:self];
}
- (void) captureOutput: (AVCaptureFileOutput *) captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error {
NSLog(@"didFinishRecordingToOutputFileAtURL");
BOOL recordedSuccessfully = YES;
if ([error code] != noErr){
id value = [[error userInfo] objectForKey:AVErrorRecordingSuccessfullyFinishedKey];
NSLog(@"recording value %@", value);
if (value){
recordedSuccessfully = [value boolValue];
}
}
if (recordedSuccessfully){
NSLog(@"recorded Successfully");
在此例程结束时,我收到消息“已成功录制”,但未启用录制按钮。
我是否需要手动释放会话或其他东西以便我可以重置视图?