开发者

Pause/resume video recording with AVFoundation

开发者 https://www.devze.com 2023-03-23 18:05 出处:网络
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 m

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消