AVCam is not in full screen mode

I have enabled AVCam in my iOS app. The problem is in the iPhone 4, the preview frame is not full-screen, it has empty border frames ...

How can i solve this?

Thanks.

+7
ios border fullscreen avcam
source share
2 answers

You need to use the videoGravity property for AVCaptureVideoPreviewLayer .

Take a look at the doc . You need to use: AVLayerVideoGravityResizeAspectFill

Edit:

Based on this, the decision based on the appeal is as follows:

 - (void)setSession:(AVCaptureSession *)session { ((AVPlayerLayer *)[self layer]).videoGravity = AVLayerVideoGravityResizeAspectFill; ((AVPlayerLayer *)[self layer]).bounds = ((AVPlayerLayer *)[self layer]).bounds; [(AVCaptureVideoPreviewLayer *)[self layer] setSession:session]; } 
+22
source share

Fixed it using the following method in AVCamPreviewView.

 - (void)setSession:(AVCaptureSession *)session { ((AVPlayerLayer *)[self layer]).videoGravity = AVLayerVideoGravityResizeAspectFill; ((AVPlayerLayer *)[self layer]).bounds = ((AVPlayerLayer *)[self layer]).bounds; [(AVCaptureVideoPreviewLayer *)[self layer] setSession:session]; } 
+3
source share

All Articles