Screenshot of AVCaptureVideoPreviewLayer

I have an application that adds some live effects, animations and images to preview view in AV Foundation camera. I can capture video of it with ReplayKit and do hardware screenshot(holding sleep button and pressing home button). However I need a button that makes screenshot. All the methods of taking screenshot like UIGraphicsGetImageFromCurrentImageContext result in black screen where video preview is. All other elements are on the screenshot except the image. It seems odd that Apple doesn't provide method for their hardware screenshot. What I'm missing?

Replies

I too am very interested in this. I have the same issue with an AVFoundation view inside a WKWebView. A call to WKWebView's "takeSnapshotWithConfiguration:" method yields an image with everything except the video content that is present in the view. The video content region shows up as a black square.