From a6f932480c3607eb0260a715715ce89add7cc21d Mon Sep 17 00:00:00 2001 From: Kristian Damian Date: Wed, 26 Aug 2020 14:22:00 -0600 Subject: [PATCH] Add front camera usage in Android --- Source/CameraPreview.Droid/CameraController.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/CameraPreview.Droid/CameraController.cs b/Source/CameraPreview.Droid/CameraController.cs index 16e57fb..e924832 100644 --- a/Source/CameraPreview.Droid/CameraController.cs +++ b/Source/CameraPreview.Droid/CameraController.cs @@ -104,7 +104,13 @@ private void SetUpCameraOutputs(int width, int height) // We don't use a front facing camera in this sample. var facing = (Integer)characteristics.Get(CameraCharacteristics.LensFacing); - if (facing != null && facing == (Integer.ValueOf((int)LensFacing.Front))) + if (facing != null && facing == (Integer.ValueOf((int)LensFacing.Front)) && + !CameraPreviewSettings.Instance.ScannerOptions.UseFrontCameraIfAvailable.GetValueOrDefault()) + { + continue; + } + if (CameraPreviewSettings.Instance.ScannerOptions.UseFrontCameraIfAvailable.GetValueOrDefault() && + facing != null && facing != (Integer.ValueOf((int)LensFacing.Front))) { continue; }