public CameraState addPreviewLayerToView(UIView view, Action completion, bool tensorflowAnalysis) { this.tensorflowAnalysis = tensorflowAnalysis; if (_canLoadCamera()) { if (embeddingView != null) { if (previewLayer != null) { previewLayer.RemoveFromSuperLayer(); } } if (cameraIsSetup) { _addPreviewLayerToView(view); completion?.Invoke(); } else { _setupCamera( () => { this._addPreviewLayerToView(view); completion?.Invoke(); }); } } return(_checkIfCameraIsAvailable()); }
public void ConfigureCaptureSession(AVCaptureSession captureSession, AVCaptureStillImageOutput captureOutput) { if (previewLayer != null) { previewLayer.RemoveFromSuperLayer(); previewLayer = null; } previewLayer = new AVCaptureVideoPreviewLayer(captureSession) { VideoGravity = AVPlayerLayer.GravityResizeAspect, Frame = Bounds }; Layer.AddSublayer(previewLayer); CaptureOutput = captureOutput; CaptureOutput.AddObserver(this, capturingStillImageKeypath, NSKeyValueObservingOptions.New, IntPtr.Zero); }
public CameraState addPreviewLayerToView(UIView view, CameraOutputMode newCameraOutputMode, Action completion) { if (_canLoadCamera()) { if (embeddingView != null) { if (previewLayer != null) { previewLayer.RemoveFromSuperLayer(); } } if (cameraIsSetup) { _addPreviewLayerToView(view); OutputMode = newCameraOutputMode; if (completion != null) { completion(); } } else { _setupCamera( () => { this._addPreviewLayerToView(view); this.OutputMode = newCameraOutputMode; if (completion != null) { completion(); } } ); } } return(_checkIfCameraIsAvailable()); }
void TeardownAVCapture() { previewLayer.RemoveFromSuperLayer(); previewLayer = null; }