ios - Pause video recording

2019-03-27 13:43发布

问题:

I'm try to create application where user can record video from camera. One of the feature of this application must be a pause file recording. For example: User start record after pressing "Start" button. After some time user press "Pause" button and video recording paused. Then user press "Resume" button and video continue recording in the same file. Can any body help me? Thank you.

WBR Maxim

回答1:

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];
}


标签: ios xcode record