Kirill  Simakov
Kirill Simakov

Reputation: 161

Screen video recording at Mac OS X

I'm working with AVFoundation to record screen or part of screen. Here 2 code samples 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

Simple fullscreen recording or recording with cropping rect just fine, but when i'm trying to change rect while recording, i'm getting error:

Did finish recording to file://localhost/Users/Shared/screenMovie.mp4 due to error Error Domain=AVFoundationErrorDomain Code=-11806 "Recording Stopped" UserInfo=0x13a07f9e0 {AVErrorRecordingSuccessfullyFinishedKey=true, NSLocalizedDescription=Recording Stopped, NSLocalizedRecoverySuggestion=Try recording again.}

Apple documentation says about error with code -11806:

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

I can't find any info in docs about it. i have suggestion, that i can't change rect while recording. But at the same time i can't find any proof about it.

Upvotes: 4

Views: 2922

Answers (1)

Marcel
Marcel

Reputation: 6579

When you change the rect while recording, the recording format changes and it can't continue to record to same output. However, you can continue recording to a 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

}

Upvotes: 2

Related Questions