Pause/resume video recording with AVFoundation
I am using AVFoundation f开发者_开发百科ramework for video recording. I need to implement the functionality to pause the recording and user can also resume it. I searched alot but couldn't find any material.
One idea I have in mind is to call the following method to pause the recording without closing the session :
[outputfile stopRecording];
and for resuming I should call:
startRecordingToOutputFileURL:fileURL recordingDelegate:self];
But after doing this the following delegate method is never called:
- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
fromConnections:(NSArray *)connections error:(NSError *)error
Is there any other way to pause/resume video recording?
I made it by stopping the recording when user presses "Pause" and write a file to documents directory. When user presses "Resume", I start recording in a new file. At the end I combine all these in a single file. And cleanup at the end.
精彩评论