Enabled use case problem
hosseinkaramii opened this issue · comments
Hi. first of all, thanks for developing this package.
I have tested this package and it works great but I have a device which has android 6.
When I launch CameraScreen, it gives me this exception:
The selected camera does not support the enabled use cases. Please "
+ "disable use case and/or select a different camera. e.g. "
+ "#setVideoCaptureEnabled(false)
how can I solve it?
I used this:
cameraState.controller.setEnabledUseCases(CameraController.IMAGE_ANALYSIS)
but nothing changed.
any idea?
Hii!, same error when I try to switch to the front camera while I'm in video mode.
The error log:
java.lang.IllegalStateException: The selected camera does not support the enabled use cases. Please disable use case and/or select a different camera. e.g. #setVideoCaptureEnabled(false)
at androidx.camera.view.CameraController.startCameraAndTrackStates(CameraController.java:1718)
at androidx.camera.view.CameraController.setEnabledUseCases(CameraController.java:459)
at com.ujizin.camposer.state.CameraState.updateUseCases(CameraState.kt:232)
at com.ujizin.camposer.state.CameraState.setCaptureMode$camposer_release(CameraState.kt:145)
at com.ujizin.camposer.state.CameraState.update$camposer_release(CameraState.kt:554)
at com.ujizin.camposer.CameraPreviewKt$CameraPreviewImpl$2.invoke(CameraPreview.kt:189)
at com.ujizin.camposer.CameraPreviewKt$CameraPreviewImpl$2.invoke(CameraPreview.kt:154)
Do you have any idea?
Thank you very much in advance.
Hello, after investigating, I have come to the conclusion that if your camera is not Level 3, you cannot use the outputs of Camera Preview + Image Analysis + Video Capture.
This is clearly stated in section 8 of this codelab:
https://developer.android.com/codelabs/camerax-getting-started?hl=es-419#7
And on this other documentation webpage, it explains everything that can be done based on the camera hardware configuration of the device:
https://developer.android.com/reference/android/hardware/camera2/CameraDevice#regular-capture
I have tested it, and indeed, cameras with a hardware configuration < Level 3 do not allow me to capture video while analyzing the image.
Hello all, sorry for the delay! I was moving and i haven't had much time lately
Indeed, what @RaulBlautic mentioned is correct. I'll work on this as soon as possible!
Thanks everyone for the logs and investigation!
Hello everyone,
The new version 0.3.2 with the fix has been released!
Thanks for supporting Camposer!
Thanks @ujizin. appreciate your work!
I will try it to see weather its ok or not. Another issue. There are some android devices for cars that have 4 camera (two for behind and front and two for both sides). is there a way to display 4 of them using camposer?
Hey @hosseinkaramii
Unfortunately, it is not possible to display more than one camera at the same time with Camposer.
I believe CameraX also does not support opening more than one preview. However, if I'm not mistaken, it is possible to achieve this with Camera2.
If you would like to explore further, please check this:
https://developer.android.com/training/camera2/multiple-camera-streams-simultaneously
I hope I helped you out. Have a good week!
Hey @hosseinkaramii,
I've checked CameraX 1.3 in Compose, and now multiple cameras can be used simultaneously. However, integrating this into Camposer requires some effort.
Currently, CameraX supports this only in the camera Provider feature, while Camposer uses the Camera controller feature.
For more info you can check: https://android-developers.googleblog.com/2023/06/camerax-13-is-now-in-beta.html.