void Initialize() { captureSession = CaptureSession.Create(this); if (captureSession == null) { //FIXME: This means the device doesn't have a camera.. BackgroundColor = UIColor.Gray; return; } Layer.MasksToBounds = true; captureSession.SetPreviewLayer(Layer); Layer.Connection.VideoOrientation = AVCaptureVideoOrientation.Portrait; Layer.VideoGravity = AVLayerVideoGravity.ResizeAspectFill; }