Screen Recording on Mac OS X

I work with AVFoundation to record a screen or part of a screen. Here are 2 sample code for which I work.

1.http : //developer.apple.com/library/mac/#samplecode/AVScreenShack/Listings/AVScreenShack_AVScreenShackDocument_m.html

2. http://developer.apple.com/library/mac/#qa/qa1740/_index.html

A simple full-screen or straight-cropped recording is just fine, but when I try to change rect while recording, I get an error message:

Finished writing to the file: //localhost/Users/Shared/screenMovie.mp4 due to error Error Domain = AVFoundationErrorDomain Code = -11806 "Recording stopped" UserInfo = 0x13a07f9e0 {AVErrorRecordingSuccessfullyFinishedKey = true, NSLocalizedDescriptionLest record = Restore Recording = stopped .}

Apple documentation says error code -11806:

AVErrorSessionConfigurationChanged Recording stopped because the configuration of media sources and destinations was changed.

I can not find the information in the docs about this. I have an assumption that I cannot change rect while recording. But at the same time, I can not find any evidence.

+4
source share
1 answer

When you change the rectangle during recording, the recording format is changed and it cannot continue recording to the same output. However, you can continue to write to the new file.

- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error { // Check for error // If an error occurred and AVErrorRecordingSuccessfullyFinishedKey is YES, then // start recording to a new file here } 
+1
source

All Articles