Closed qwaskhaled closed 2 years ago
Hi @qwaskhaled , here are two ideas for you:
exchangeDevices
API and also using the preset front/back cameras. Instead of using the preset cameras, you can manage the camera in your own application so that you can access the CameraX APIs you're interested in. Once your application is managing the camera itself, you can use BroadcastSession.createImageInputSource()
to get a SurfaceSource
, then call getInputSurface()
on that SurfaceSource
to get the underlying Surface
. Then you can use the Surface
to feed data from your application-managed camera to the broadcast session. These APIs can be used for any custom image sources (a camera, static image, etc.)exchangeDevices
API to show the behaviour you're describing, please submit a feature request to IVS so we can add it to our internal roadmap.Thanks!
Is there any way I can freeze the camera when I switch between front and back?
CameraX for Android has an observer that returns the state of the viewFinder which helps at showing the last image of the viewFinder instead of blank
binding.viewFinder.previewStreamState.observe(viewLifecycleOwner, { streamState -> if (streamState == PreviewView.StreamState.STREAMING) {