Camera preview is distorted when using builtInUltraWideCamera and LivePhotoCapture is enabled

80 views Asked by At

When I enable LivePhotoCapture on my AVCapturePhotoOutput and switch to builtInUltraWideCamera on my iPhone 12, I get a distorted image on the preview layer. The issue goes away if LivePhotoCapture is disabled.

This issue isn't reproducible on iPhone 13 Pro.

Tried to play with videoGravity settings, but no luck. Any tips are appreciated!

On my AVCapturePhotoOutput:

if self.photoOutput.isLivePhotoCaptureSupported {
    self.photoOutput.isLivePhotoCaptureEnabled = true
}

Preview layer:

videoPreviewLayer = AVCaptureVideoPreviewLayer(session: captureSession)
videoPreviewLayer.videoGravity = .resizeAspect
videoPreviewLayer.connection?.videoOrientation = .portrait
previewView.layer.addSublayer((videoPreviewLayer)!)

self.captureSession.startRunning()
self.videoPreviewLayer.frame = self.previewView.bounds

Result (the picture is mirrored, but it's not a problem, the problem is on the right and bottom edges of the picture):

enter image description here

0

There are 0 answers