Note that there are some explanatory texts on larger screens.

plurals
  1. POApplication resignes active state while video recording
    primarykey
    data
    text
    <p>I have a problem with recording video in my app. After recording for 54 secs the application resignes active state. Is there a way to block it until after the video recording stops? Here is the code I use to record video: </p> <pre><code> captureSession = &lt;initialized capture session&gt; //using the back camera and the mic movieFileOutput = [[AVCaptureMovieFileOutput alloc]init]; if( ![captureSession canAddOutput:movieFileOutput]) { NSLog(@"Can't add movie file output!"); return; } [self.captureSession beginConfiguration]; [captureSession addOutput:movieFileOutput]; [self.captureSession commitConfiguration]; NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0]; NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"]; NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone]; NSInteger sourceGMTOffset = [sourceTimeZone secondsFromGMTForDate:now]; NSInteger destinationGMTOffset = [destinationTimeZone secondsFromGMTForDate:now]; NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset; NSDate* destinationDate = [[[NSDate alloc] initWithTimeInterval:interval sinceDate:now] autorelease]; NSString *caldate = [destinationDate description]; NSString *recorderFilePath = [[NSString stringWithFormat:@"%@/%@.mov", DOCUMENTS_FOLDER, caldate] retain]; NSURL *url = [NSURL fileURLWithPath:recorderFilePath]; [recorderFilePath release]; [captureSession startRunning]; for ( AVCaptureConnection *connection in [movieFileOutput connections] ) { for ( AVCaptureInputPort *port in [connection inputPorts] ) { if ([[port mediaType] isEqual:AVMediaTypeVideo] ) { if([connection isVideoOrientationSupported]) { [connection setVideoOrientation: [[UIDevice currentDevice] orientation]]; } } } } [movieFileOutput startRecordingToOutputFileURL:url recordingDelegate:self]; isRecording = YES; NSLog(@"Started video recording."); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload