How do I pause a video the moment I take a photo?

I am using AVFoundation to display video in a UIView using AVCaptureVideoPreviewOverlay . Then I use AVStillImageOutput - captureStillImageAsynchronouslyFromConnection : to capture a still image from a video with the predefined AVCaptureSessionPresetPhoto .

I am freezing a video using AVCaptureSession - stopRunning in the captureStillImageAsynchronouslyFromConnection completion block mentioned earlier. However, it is too late, and the video continues to work while a still image is taken, so freezing occurs after a second or two. When I show the image, a jump occurs.

How can I freeze the video the moment the photo was taken?

+8
ios iphone avfoundation avcapture
source share
1 answer

Almost a year later ... Your approach is wrong. Instead of trying to pause the video while the image is being captured, why don't you pause the video and then capture that paused image. It does not matter to the user; the developer does not need to worry about the exact accuracy.

To repeat my idea, if you pause the video and start white visualization and click on a click, the user will think that you just captured this frame, regardless of whether you are or not. In fact, you might consider pausing a video in the same way as capturing an image without saving it.

+1
source share

All Articles