Callback for preview showing camera live stream

302 views
Skip to first unread message

Raz

unread,
Aug 21, 2021, 12:58:39 PM8/21/21
to Android CameraX Discussion Group
When binding the preview to the lifecycle after switching cameras or changing use cases settings, it takes some time for the preview to reload,  and in the meantime a black screen is shown. Is there any callback for when the preview starts showing the camera live stream? I looked through the PreviewView class and I didn't see anything for that, so can this callback be implemented? and if so how?
The purpose of this is for example to show blur or other animation when restarting the preview, and end the animation when preview shows the camera feed again.
Thanks in advanced,
Raz

Scott Nien

unread,
Aug 23, 2021, 12:31:20 AM8/23/21
to Raz, Android CameraX Discussion Group
Reply to all again:

You can try PreviewView#getPreviewStreamState . If the stream state becomes PreviewView.StreamState.STREAMING then it means the camera is streaming. 


--
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/05d70b44-6ab0-4a7b-901d-90078a3d3bd4n%40android.com.
Reply all
Reply to author
Forward
0 new messages