user1209216
user1209216

Reputation: 7914

Make Android Emulator use physical usb camera

Android Studio, latest Google SDK emulator. I have set back camera emulation mode to Webcam0 to get my usb camera connected to emulator. Unfortunately, it's not working. My camera works without any problems on host computer, for example this:

ffplay /dev/video0

gives me camera video playback. When I run emulator with above settings, camera on emulator just says "Unable connect to camera", then closes itself. Have anybody ever succeded with connecting physical camera to Android emulator? I have found some similar problems out there, but none of them has been resolved.

Upvotes: 3

Views: 9701

Answers (1)

ralf htp
ralf htp

Reputation: 9422

you can try to edit the config.ini of the AVD in ~/.android/avd/avd_name/config.ini like in this link http://viralpatel.net/blogs/enable-camera-in-android-emulator/ or use Android Studio directly like in this Android: How to use webcam in emulator?

if this isn't working see Lekensteyn's answer (2nd) in Connect USB device to Android Emulator?. it describes how a USB device can be passed through to a QEMU emulator. Android emulator is modified QEMU for more details see https://developer.android.com/studio/run/emulator-commandline.html

to find out if your webcam is recognized anyway try emulator @avd_name -webcam-list to get the available AVD use android list avd

more on passing through a USB device to QEMU emulator is also in https://unix.stackexchange.com/questions/250938/qemu-usb-passthrough-windows-guest

Upvotes: 3

Related Questions