使用 AVFoundation 暂停/恢复视频录制
我正在使用 AVFoundation 框架进行视频录制。我需要实现暂停录制的功能,并且用户也可以恢复录制。我进行了很多搜索,但找不到任何材料。
我想到的一个想法是调用以下方法来暂停录制而不关闭会话:
[outputfile stopRecording];
为了恢复,我应该调用:
startRecordingToOutputFileURL:fileURLrecordingDelegate:self];
但执行此操作后,以下委托方法从未被调用:
- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
fromConnections:(NSArray *)connections error:(NSError *)error
还有其他方法可以暂停/恢复视频录制吗?
I am using AVFoundation framework 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过在用户按“暂停”时停止录制并将文件写入文档目录来实现。当用户按“恢复”时,我开始在新文件中录制。最后,我将所有这些合并到一个文件中。并在最后进行清理。
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.