使用 AVFoundation 暂停/恢复视频录制

发布于 2024-11-26 16:03:32 字数 542 浏览 4 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仙气飘飘 2024-12-03 16:03:32

我通过在用户按“暂停”时停止录制并将文件写入文档目录来实现。当用户按“恢复”时,我开始在新文件中录制。最后,我将所有这些合并到一个文件中。并在最后进行清理。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文