ujizin / Camposer

Camera Library for Android Jetpack Compose. 📸✨

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for UVC Camera

opened this issue · comments

Is your feature request related to a problem? Please describe.
The device I used didn't have a built-in camera, it connected to an external UVC Camera via USB.
Currently, there's no way to connect UVC Camera in Camposer.

Describe the solution you'd like
Add parameter when use CamSelector, it can be the VID/PID or a UsbDevice instance.

Describe alternatives you've considered
None.

Are you willing to provide a PR?
I'm a beginner programmer and this might be too difficult for me. But I'll try to help.

I found that on devices without a camera, adding the USB_ACCESSORY_ATTACHED permission in AndroidManifest.xml allows the UVC camera to be recognized as a Front/Back camera. This might be useful.

Hey @ywdncn, thanks for opening the issue!

I've been searching about this in relation to CameraX because Camposer was built upon it, but AFAIK, UVC only supports Camera2. 😢

It's possible that it may be supported in the future, considering that CameraX is built upon Camera2

You can find more information in the docs: https://source.android.com/docs/core/camera/external-usb-cameras.

Please feel free to share any research or information you come across regarding this topic

I found that on devices without a camera, adding the USB_ACCESSORY_ATTACHED permission in AndroidManifest.xml allows the UVC camera to be recognized as a Front/Back camera. This might be useful.

I couldn't find anything about USB_ACCESSORY_ATTACHED related to lens facing. Could you please fork the repository and test it on a sample project to see if it works?"

I found that on devices without a camera, adding the USB_ACCESSORY_ATTACHED permission in AndroidManifest.xml allows the UVC camera to be recognized as a Front/Back camera. This might be useful.

I couldn't find anything about USB_ACCESSORY_ATTACHED related to lens facing. Could you please fork the repository and test it on a sample project to see if it works?"

I set "camSelector = CamSelector.Back" on a device that only had a UVC camera and it successfully displayed the image.