I'm using a AVCaptureSession with an AVCaptureVideoPreviewLayer with the AVLayerVideoGravityResizeAspectFill gravity.
self.captureSession =[[AVCaptureSession alloc] init];
captureSession.sessionPreset = AVCaptureSessionPresetPhoto;
self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.captureSession];
[self.previewLayer setVideoGravity: AVLayerVideoGravityResizeAspectFill];
How to know how the video will be resized to fit the preview area with the AVLayerVideoGravityResizeAspectFill? Which part of the image is visible in the preview area?
From the doc:
AVLayerVideoGravityResizeAspectFill: This preserves the aspect ratio, but fills the available screen area, cropping the video when necessary
Basically, how to get exactly what was displayed in the previewLayer ?
With the iOS 6 SDK I can use the following in AVCaptureVideoPreviewLayer
(CGPoint)captureDevicePointOfInterestForPoint:(CGPoint)pointInLayer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With