Android Question Camera2: Auto_flash in Preview

Erel

Administrator
Staff member
Licensed User
I don't think that the flash is supposed to be turned on while in preview.

This code forces it to be on in preview mode (tested on a single device):
B4X:
cam.AutoExposureMode = "OFF"
cam.PreviewSettingsMap.Put("FLASH_MODE", 2) 'TORCH
cam.StartPreview(MyTaskIndex, VideoMode)
cam.AutoExposureMode = "ON"
cam.PreviewSettingsMap.Put("FLASH_MODE", 2) 'TORCH
cam.StartPreview(MyTaskIndex, VideoMode)
 

Karl Matzinger

Member
Licensed User
Hi Erel,
Preview torch works great, but when taking a picture in darkness the ON_AUTO_FLASH isn't working - no flash and the taken picture is dark.
sorry for delay ...

I added 2 buttons

B4X:
Sub btnLightOff_Click
   cam.AutoExposureMode = "OFF"
   cam.PreviewSettingsMap.Put("FLASH_MODE", 2) 'TORCH
   cam.StartPreview(MyTaskIndex, VideoMode)
End Sub

Sub btnLightOn_Click
   cam.AutoExposureMode = "ON"
   cam.PreviewSettingsMap.Put("FLASH_MODE", 2) 'TORCH
   cam.StartPreview(MyTaskIndex, VideoMode)
End Sub
Or did I wrong?

tx
karl
 
Last edited:
Top