Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>After AVCaptureSession allocation you may use:</p> <pre><code>NSNotificationCenter *notify = [NSNotificationCenter defaultCenter]; [notify addObserver: self selector: @selector(onVideoError:) name: AVCaptureSessionRuntimeErrorNotification object: session]; [notify addObserver: self selector: @selector(onVideoStart:) name: AVCaptureSessionDidStartRunningNotification object: session]; [notify addObserver: self selector: @selector(onVideoStop:) name: AVCaptureSessionDidStopRunningNotification object: session]; [notify addObserver: self selector: @selector(onVideoStop:) name: AVCaptureSessionWasInterruptedNotification object: session]; [notify addObserver: self selector: @selector(onVideoStart:) name: AVCaptureSessionInterruptionEndedNotification object: session]; </code></pre> <p>These are calling back the relevant methods upon session.stopRunning, session.startRunning etc.</p> <p>There you should also implement some undocumented cleanup block:</p> <pre><code>AVCaptureInput* input = [session.inputs objectAtIndex:0]; [session removeInput:input]; AVCaptureVideoDataOutput* output = (AVCaptureVideoDataOutput*)[session.outputs objectAtIndex:0]; [session removeOutput:output]; </code></pre> <p>What I found confusing though is that upon calling seesion.stopRunning, onVideoStop: is called synchronously! despite Apple's asynchronous assumption on the case.</p> <p>Its working but please let me know in case you see any trick. I would prefer working with it asynchronously.</p> <p>Thanks </p>
 

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