AVLayerVideoGravityResizeAspectFill在哪里裁剪

fst*_*any 5 iphone camera ios

我使用的是AVCaptureSession具有AVCaptureVideoPreviewLayerAVLayerVideoGravityResizeAspectFill重力.

self.captureSession =[[AVCaptureSession alloc] init];
captureSession.sessionPreset = AVCaptureSessionPresetPhoto;
self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.captureSession];
[self.previewLayer setVideoGravity: AVLayerVideoGravityResizeAspectFill];
Run Code Online (Sandbox Code Playgroud)

如何知道如何调整视频大小以适应预览区域AVLayerVideoGravityResizeAspectFill?在预览区域中可以看到图像的哪个部分?

来自doc:

AVLayerVideoGravityResizeAspectFill:这会保留纵横比,但会填充可用的屏幕区域,必要时裁剪视频

基本上,如何准确获取previewLayer中显示的内容?

fst*_*any 1

通过iOS 6 SDK,我可以使用以下内容AVCaptureVideoPreviewLayer

(CGPoint)captureDevicePointOfInterestForPoint:(CGPoint)pointInLayer
Run Code Online (Sandbox Code Playgroud)