ankit_rck
ankit_rck

Reputation: 1806

AvCapture Session full screen in iphone 4s

I am developing with AvCapture session to add cutom overlays on camera screen. I have added an AvCaptureVidePreview layer as

AvCaptureVideoPreviewLayer*layer = [[AvCaptureVideoPreviewLayer alloc] iniWithSession:session];
layer.frame = self.view.layer.bounds;

but the camera preview is not full screen in case of iPhone 4S. It works fine in iPhone 5.

Upvotes: 3

Views: 979

Answers (1)

sbrsantanu
sbrsantanu

Reputation: 137

CGRect bounds=view.layer.bounds;
layer.videoGravity = AVLayerVideoGravityResizeAspectFill;
layer.bounds=bounds;
layer.position=CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));

may be it can help you..

Upvotes: 5

Related Questions