I am trying to automatically trigger flash when capturing an image using the Camera2 API. I tried to use both CONTROL_AE_MODE_ON_ALWAYS_FLASH and CONTROL_AE_MODE_ON_AUTO_FLASH but both did not work.
What I tried:
Setting CONTROL_AE_MODE to CONTROL_AE_MODE_ON_ALWAYS_FLASH for the still capture builder
val captureRequestBuilder = cameraDevice
.createCaptureRequest(AndroidCameraDevice.TEMPLATE_STILL_CAPTURE)
captureRequestBuilder.apply {
set(CaptureRequest.CONTROL_AE_MODE,
CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH)
}
I have also done the same for the preview builder (TEMPLATE_PREVIEW) but I was not successful in triggering the flash
Similar was done using CONTROL_AE_MODE_ON_AUTO_FLASH but it did not work too, I need both to work.
Referring to the camera samples provided by Google lead to nothing
camera samples
Is a precapture phase required to be able to setup flash?
Camera2 basic repository that uses precapture and flash before being archived
/a/37149446/25778714
https://developer.android.com/reference/android/hardware/camera2/CaptureResult#CONTROL_AE_PRECAPTURE_TRIGGER
user25778714 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.