mpromonet / webrtc-streamer

WebRTC streamer for V4L2 capture devices, RTSP sources and Screen Capture
https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/?layout=2x2
The Unlicense
2.94k stars 598 forks source link

How can I access the host's microphone in a Dockerized webrtc-streamer? (mic seemingly detected, but /api/getAudioDeviceList does not list it) #486

Open johanehr opened 2 years ago

johanehr commented 2 years ago

Hi!

I am trying to use webrtc-streamer to allow remote access to a video and audio stream on the same network as the host. The system where this is being run is a customized older version of Ubuntu Server, which does not run the v0.6.5 release natively. To get around this, I have Dockerized it together with some wrapper functionality and can access the video stream just fine (--device /dev/video0 --net=host were needed).

However, now that I am trying to also include the audio stream, I am encountering issues. By running the webrtc-streamer server locally on my Ubuntu 20.04 system (outside of Docker), and using the html-examples/embedded-example.html client I can remotely listen in on the audio, and the expected devices show up if I query /api/getAudioDeviceList - so it seems like a pure Docker issue.

While this is not strictly a webrtc-streamer problem, I was wondering if anyone could share some advice on how to enable access to the Docker host's microphone(s)? Additionally, I think this would make a great addition to the Docker section of the README.

So far I have tried adding the following arguments:

With this setup, the Docker image has access to the host's /sys/class/sound - so I would have expected /api/getAudioDeviceList to display the host devices, so I assume something else is missing..?

I'd be very grateful for any advice :) Thank you!

EDIT: Additionally, I can see the microphone from the Docker image using arecord -l, as my Docker image setup includes the installation of the following: