/// <summary> /// Sets up the video preview layer. /// </summary> protected void SetupVideoPreviewLayer() { VideoPreviewLayer = new AVCaptureVideoPreviewLayer(Session) { Frame = PreviewContainer.Bounds, VideoGravity = AVLayerVideoGravity.ResizeAspectFill }; PreviewContainer.Layer.AddSublayer(VideoPreviewLayer); if (Configuration.DetectFaces) { _overlayLayer = new CALayer(); _overlayLayer.Frame = Bounds; _overlayLayer.SublayerTransform = CATransform3D.Identity.MakePerspective(1000); VideoPreviewLayer.AddSublayer(_overlayLayer); } }