kroumvud kroumvud - 3 months ago 51
iOS Question

ios - Pause video recording

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.



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