budtmo / docker-android

Android in docker solution with noVNC supported and video recording
Other
8.81k stars 1.19k forks source link

[šŸ› Bug ]: Emulator camera not working with webcam #380

Closed AndreasWJ closed 11 months ago

AndreasWJ commented 11 months ago

Operating System

Ubuntu 20.04

Docker Image

budtmo/docker-android:emulator_11.0

Expected behaviour

I expect the camera app to get its video feed from /dev/video0: docker run -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true -e APPIUM=true -e EMULATOR_ARGS="-camera-back webcam0" --device /dev/kvm --device /dev/video0:/dev/video0 --group-add video --name android-container budtmo/docker-android:emulator\_11.0

Actual behaviour

The green guy in the camera is still visible in the camera app where I expect the webcam to be. What I've done so far is map the host's /dev/video0 to the container's /dev/video0 with: --device /dev/video0:/dev/video0 With: -e EMULATOR_ARGS="-camera-back webcam0"

The issue when running with these two is that the container's androidusr doesn't have permissions to /dev/video0: emulator -webcam-list I added: --group-add video which now shows the webcam.

The video feed still can't be seen in the camera app, so I did the following: emulator -avd samsung_galaxy_s10_11.0 -camera-back webcam0 This gives an error at first: "running multiple emulators with the same avd". But this error can be fixed by removing .lock files in /home/androidusr/emulator.

The issue then is that the emulator gets stuck in a start loop, all you can see is the Google logo.

Logs

No response

AndreasWJ commented 11 months ago

Got it working! The issue was that I had the wrong environment variable set, it should be -e EMULATOR_ADDITIONAL_ARGS not -e EMULATOR_ARGS.