Question

I am having some issues trying to know why the AVCaptureVideoPreviewLayer is shortening the angle of the camera. By that I mean that the camera has more zoom that the default camera or the UIImagePickerController camera. I tested the AVCaptureVideoPreviewLayer and it looks like its zoomed in just like when you use the Video option on the default camera app.

Is it possible that I can take back that extra zoom? I want the camera wide angle and not a video zoom. I am using an overlay and that's why I am using this option.

Was it helpful?

Solution

There are a couple of properties you could try modifying to solve this. The first and most likely one I'd try is the sessionPreset property on your AVCaptureSession. You'll probably want to try AVCaptureSessionPresetPhoto, but there are more options, which can be found in the docs

[session setSessionPreset:AVCaptureSessionPresetPhoto];

This differs from the video presets in that it doesn't shorten the capture angle, whereas all of the video presets will zoom and crop the input.

Other than that, you may want to tweak the contentGravity property on the preview layer itself.

[previewLayer setContentsGravity:AVLayerVideoGravityResizeAspectFill];

It only has three options though, AVLayerVideoGravityResize, AVLayerVideoGravityResizeAspect, and AVLayerVideoGravityResizeAspectFill.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top