While I was experimenting with CameraX1.0.0
I wanted to verify in advance if there was a camera that satisfies certain conditions before opening the camera and interacting with the API, I proceeded to do that with a CameraSelector
that implemented a custom filter, however I can only check if there is an available camera until I call processCameraProvider.bindToLifecycle(lifecycleOwner, cameraSelector)
this works fine but requires to bind the camera selector so that the filter runs.
Then later I found about processCameraProvider.hasCamera(cameraSelector)
which runs the selector and returns a boolean, I'd like to get the actual CameraInfo
that gets selected beforehand, the documentation states that ProcessCameraProvider
has this API ProcessCameraProvider#getavailablecamerainfos
, but it's not available once I want to use it in code.
Is there a way to get the selected cameraInfo without actually binding? If not, and considering that the custom filter reflects the use cases configurations to look for sizes, would the camera returned by processCameraProvider.bindToLifecycle(lifecycleOwner, cameraSelector)
be the same we would get by calling processCameraProvider.bindToLifecycle(lifecycleOwner, cameraSelector, useCases)
I would like to avoid binding the use cases just to know if there is a camera that might work.