简体   繁体   中英

Using an External Usb Camera in Android

Could somebody give me an instruction, how to use an external camera in android app. My app need to use front/back and external cameras but there is no official external camera API I found some issues about this, but they don't have a full answer on how to implement this functionality and especially for android API 21+ versions. As I understand, Camera2 API supports external camera and I can use this API for displaying preview from usb-camera, but most of devices can not see connected external camera. How can I fix this and how can I get this camera id when receive cameras list

String[] cameraList = manager.getCameraIdList();

About "devices can not see usb-camera" I find a few answers : USB camera can not be connected to Android in general, because Android4.0 USB host function has some problems about isochronous transfer..

http://www.infinitegra.co.jp/en/solution/AndroidUsbCam.htm

and maby camera does not getting power from usb-port

https://stackoverflow.com/a/8986688/5219832

But it is written about the old camera API and I don't know, for example, how to get power from usb-port.

Please give me an answer for correctly working with external camera

There's no Android-wide support for external USB cameras.

Some manufacturers have built in support for their own Android devices, but there's no guarantee that a particular Android device will support a webcam over the standard camera APIs.

If you need this feature, you'll need to find which devices support it, and how.

Some applications use the Android USB APIs to implement support for webcams, so that any device that supports USB host mode will work for those applications. But that won't make the cameras visible to other applications through the standard APIs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM