Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 22b1d4c

Browse files
GUOLDEVGustavo Oliveira
andauthored
CameraView Flash fix for Android (#1864)
Update CameraFragment.android.cs Co-authored-by: Gustavo Oliveira <[email protected]>
1 parent 4467bf2 commit 22b1d4c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/CommunityToolkit/Xamarin.CommunityToolkit/Views/CameraView/Android/CameraFragment.android.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,14 @@ public void TakePhoto()
341341
{
342342
session.StopRepeating();
343343
repeatingIsRunning = false;
344+
345+
// Reset FlashMode if Single
346+
if (flashMode == FlashMode.Single)
347+
{
348+
sessionBuilder.Set(CaptureRequest.FlashMode ?? throw new NullReferenceException(), (int)FlashMode.Off);
349+
session.Capture(sessionBuilder.Build(), null, null);
350+
}
351+
344352
sessionBuilder.AddTarget(photoReader.Surface);
345353
sessionBuilder.Set(CaptureRequest.FlashMode ?? throw new NullReferenceException(), (int)flashMode);
346354
/*sessionBuilder.Set(CaptureRequest.JpegOrientation, GetJpegOrientation());*/

0 commit comments

Comments
 (0)