Iphone – Immediately freeze-frame an AVCaptureSession

avfoundationiphone

I'm building an app that allows users to snap pictures using the iPhone camera, and am using AVFoundation when it's available (iOS4) so users can use the tap-to-focus feature, even with a custom overlay.

The problem I'm having is that captureStillImageAsynchronouslyFromConnection takes several seconds to complete, during which I'd like to freeze-frame the main video feed so there isn't a confusing state where the video is still running, but the user has snapped a photo (and the camera shutter sound has gone off).

I've tried calling [session stopRunning] right after I request a still image capture, but this leads to unpredictable results; the still image completion block often doesn't get fired in that case.

Any ideas on how I could have the video preview layer "pause" as soon as the shutter is hit?

Best Answer

You just need to set your captureVideoPreviewLayer.connection.enabled = NO;

For details please see my answer here:

AVCaptureSession pause?

Related Topic