Update preview session parameters

67 views
Skip to first unread message
Assigned to tonyt...@google.com by scot...@google.com

Tatiana

unread,
Jul 15, 2025, 8:36:21 AMJul 15
to Android CameraX Discussion Group
Hello,
In our custom cameraX application we need to update preview capture request parameters without use case rebinding (as it cause camera black screen blink).
Example: need to change CONTROL_AE_PRECAPTURE_TRIGGER parameter for preview use case or fps range value several times during session. Please advice correct way to do that.

Thank you,
Tatiana.

tonyt...@google.com

unread,
Jul 16, 2025, 3:33:26 AMJul 16
to Android CameraX Discussion Group, tatiana.zal...@gmail.com
Hi,
Thanks for the question. Currently, CameraX doesn't allow frame rate to be changed dynamically without recreating the use case. One workaround may be using Camera2CameraControl.setCaptureRequestOptions to inject CONTROL_AE_TARGET_FPS_RANGE to change frame rate. Note that on certain devices, changing CONTROL_AE_TARGET_FPS_RANGE may result in a brief freeze of the preview, especially when the FPS is increased.

For CONTROL_AE_PRECAPTURE_TRIGGER, while Camera2CameraControl.setCaptureRequestOptions can also be used to apply the parameter, CameraX will also trigger the precapture before an image capture. Changing it with Camera2CameraControl may conflict with the internal flow and result in unexpected behavior. May we know what do you want to achieve by setting CONTROL_AE_PRECAPTURE_TRIGGER?

Tatiana

unread,
Jul 16, 2025, 4:54:53 PMJul 16
to Android CameraX Discussion Group, tonyt...@google.com, Tatiana
We need to use CONTROL_AE_PRECAPTURE_TRIGGER for AE  device camera setting (with values CONTROL_AE_PRECAPTURE_TRIGGER_START and CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL when AE state is CONTROL_AE_STATE_CONVERGED).
When I use  Camera2CameraControl.setCaptureRequestOptions to set  CONTROL_AE_PRECAPTURE_TRIGGER, I cannot handle CONTROL_AE_STATE_SEARCHING or CONTROL_AE_STATE_PRECAPTURE in preview  use case callback CameraCaptureSession.CaptureCallback(). What is correct way to handle changed AE State?

Thank you.

tonyt...@google.com

unread,
Jul 17, 2025, 4:41:39 AMJul 17
to Android CameraX Discussion Group, tatiana.zal...@gmail.com, tonyt...@google.com
You may use Camera2Interop.Extender.setSessionCaptureCallback to set a callback to the Preview for monitoring the AE state change.

Tatiana

unread,
Jul 17, 2025, 4:58:30 AMJul 17
to Android CameraX Discussion Group, tonyt...@google.com, Tatiana
It is set  to Preview  and I sill cannot see updated AE States after  CONTROL_AE_PRECAPTURE_TRIGGER  value changed (I can see in preview that AE behavior applied correctly, but states  CONTROL_AE_STATE_SEARCHING didn't come)
override fun onCaptureCompleted(
                session: CameraCaptureSession,
                request: CaptureRequest,
                result: TotalCaptureResult
            ) {
         result.get(CaptureResult.CONTROL_AE_STATE)

tonyt...@google.com

unread,
Jul 17, 2025, 8:37:55 AMJul 17
to Android CameraX Discussion Group, tatiana.zal...@gmail.com, tonyt...@google.com
What device did you test this on? Were states like CONVERGED (other than SEARCHING) received as expected? Can you get SEARCHING on the same device if only using Camera2 APIs?

Tatiana

unread,
Jul 29, 2025, 8:50:03 AMJul 29
to Android CameraX Discussion Group, tonyt...@google.com, Tatiana
Thank you for your answer,
I'm successfully set  CONTROL_AE_PRECAPTURE_TRIGGER  with the   Camera2CameraControl.setCaptureRequestOptions and was able to receive correct status in preview callback

Reply all
Reply to author
Forward
0 new messages