Torch Strength Level

92 views
Skip to first unread message

Guillaume Chatelet

unread,
Oct 27, 2023, 3:12:47 AM10/27/23
to Android CameraX Discussion Group
Hi there

Do we have a way to set torch strength level (for devices over API 33) using CameraX ?

I use CameraControl.enableTorch to set torch ON and OFF but wanted to adjust the strength level when possible.  

I tried to call directly CameraManger.turnOnTorchWithStrengthLevel but it raise an Exception explaining that the camera device is already in use when CameraX use it (which sounds fair to me).

Is it possible to access this feature on a Camera handled by CameraX ?

BR

Scott Nien

unread,
Oct 29, 2023, 11:33:26 PM10/29/23
to Guillaume Chatelet, Android CameraX Discussion Group
Hi, 

This is a good suggestion.  Currently CameraX doesn't support CameraManger.turnOnTorchWithStrengthLevel  and we will discuss the feasibility. 

Scott

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/fabf9537-26e8-49ed-a5cc-a80e2379e51bn%40android.com.

Scott Nien

unread,
Oct 30, 2023, 11:17:53 PM10/30/23
to Guillaume Chatelet, Android CameraX Discussion Group
Hi , 
After some discussion, since the APIs CameraManger.turnOnTorchWithStrengthLevel can't be invoked while the camera is opened and CameraX will always open the camera,  we don't think it makes sense to add new APIs to support it. 

And currently there is no way to control the strength while the camera is opened.  The best you can do is to invoke these APIs without opening the camera. 

Scott

Reed Young

unread,
Sep 20, 2024, 1:38:48 PMSep 20
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, guil...@voila.live
That means no app using CameraX can provide manual control of the flash level.  Or am I missing something?

Scott Nien

unread,
Sep 23, 2024, 12:35:01 AMSep 23
to Reed Young, Android CameraX Discussion Group, guil...@voila.live
To clarify,   
If you need to turn on the torch and adjust torch strength without opening the camera, you can always use CameraManger.turnOnTorchWithStrengthLevel directly. 

And if you want to adjust the torch or flash strength when the camera is opened using CameraX, you can use Camera2Interop to set it. See the sample codes below:
Camera2CameraControl camera2CameraControl = Camera2CameraControl.from(mCamera.getCameraControl());
camera2CameraControl.setCaptureRequestOptions(new CaptureRequestOptions.Builder()
.setCaptureRequestOption(CaptureRequest.FLASH_STRENGTH_LEVEL, 1)
.build());
We are also planning to add new APIs to support it directly in CameraX 1.5.

Scott


Reply all
Reply to author
Forward
0 new messages