Seamless switch between 2 physical cameras

247 views
Skip to first unread message

Frank D

unread,
Jul 27, 2023, 5:18:39 PM7/27/23
to Android CameraX Discussion Group
Hello,

I've written a photo app that is able to switch from ultra wide camera to default camera on a Samsung S21 when zooming (S21 does not support virtual zoom). The way I switch is to unbind use cases and then rebind the same preview/image_capture with the new cameraSelector.
The problem is that there is a black screen during few milliseconds on the preview while the camera is not bound to anything.

Is there a recommended way to switch between cameras to avoid this black screen? or minimize the duration of the black screen?

Eino-Ville Talvala

unread,
Jul 27, 2023, 5:25:41 PM7/27/23
to Frank D, Android CameraX Discussion Group
Are you just looking for a way to avoid the black screen, or to make the transition faster?  The latter is probably not feasible - the main reason we push manufacturers to support logical camera devices that smoothly switch between ultrawide/wide/telephoto/macro lenses automatically, is to avoid these sorts of annoying pauses when switching between them.  But if a given device doesn't support it, then you have to shut down one camera and then open the next one, and the power off / power on sequences tend to take several hundred milliseconds in the best case, and sometimes quite a bit longer.

I'm not sure why black gets drawn to the output though - I'd naively expect the last frame from the previous camera to stay drawn until the next camera produces a preview frame. Can you tell if the black is truly black, or maybe the new camera just having a too-low initial exposure time (so dark but ramps up to regular brightness, instead of a hard cut from black)?  A screen recording might make this more clear.  If it's the new camera's auto-exposure starting at a poor initial guess, there's not much we can do about that, unfortunately. 




--
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/e0f15057-fe71-4716-a1f9-77190cbaf70fn%40android.com.

Frank D

unread,
Jul 30, 2023, 8:41:32 AM7/30/23
to Android CameraX Discussion Group, etal...@google.com, Android CameraX Discussion Group, Frank D
Yes it is truly black. Using S21 5G. It is the same coming from or to ultra wide. It would make sense that unbinging the use cases (and so the preview) will make the previewView full black. Maybe I should not unbind before binding again? Or use two preview views and switch between them when the second camera is already on?
Reply all
Reply to author
Forward
0 new messages