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