暂停录像 [英] Pause video recording

查看:96
本文介绍了暂停录像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个用户可以在其中录制摄像机视频的应用程序. 此应用程序的功能之一必须是文件记录中的暂停.

I'm trying to create an application where the user can record video from a camera. One of the features of this application must be a pause in file recording.

例如: 用户通过按下开始"按钮开始记录.一段时间后,用户按下暂停"按钮,视频记录暂停.然后,用户按下恢复"按钮,视频将继续记录在同一文件中.

For example: The user starts recording by pressing the "Start" button. After some time user presses the "Pause" button and video recording is paused. Then user presses the "Resume" button and video continues recording in the same file.

有人可以帮助我吗?

推荐答案

设置AVCaptureSession和AVAssetWriter,然后可以使用布尔值"isRecording"将记录关闭.

Set up an AVCaptureSession and a AVAssetWriter then you can switch the recording on an off with the boolean "isRecording".

 BOOL isRecording;

-(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
{
     if(videoWriterInput.readyForMoreMediaData && isRecording) [videoWriterInput appendSampleBuffer:sampleBuffer];
}

这篇关于暂停录像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆