This guide applies to all frameworks that create or generate iOS applications.
Support for recording video from
AVPlayerLayer or camera preview via
AVCaptureVideoPreviewLayer is not currently available.
- When user plays video with
AVPlayerin layer or in
AVPlayerViewController, the video is not recorded and the background (video content) is black.
- All camera previews are black (without content).
Both layers use low-level API that serves data to these layers via pixel buffers. Graphic data from
AVFoundation are processed directly on-device GPU with hardware support, not in
Core Graphics framework like other GUI parts. For us are these low-level layers inaccessible.
AVPlayerrecording failure is obviously an architectural problem that has not been solved by Apple for a long time. Their own
ReplayKitframework behaves exactly the same, and Apple itself points this out in the documentation.
In general, using the camera preview does not mean that the recording is not working. For example, in
ARKitwe do not have problems because internally uses
Do not use
AVCaptureVideoPreviewLayer to render the data from the device camera. Instead, use
MetalKit) to preview the camera. Such a solution works, and it does not seem to have any performance impacts.
We don't have any recommended solution yet.
Updated 11 months ago