Web-Broadcasting-Software icon indicating copy to clipboard operation
Web-Broadcasting-Software copied to clipboard

Incorrect video feed for UVC devices in Chrome on Linux and ChromeOS

Open maks opened this issue 7 years ago • 6 comments
trafficstars

Hi it seems that UVC attached devices such as usb webcams or in my case hdmi->usb dongles are not even working properly in Chrome, both on a couple of Chromebooks I have here (pixelbook on beta channel v68) and on a ubuntu 16.04 laptop running Chrome 69, though the devices are accessible just fine via native linux apps (eg. OBS) in ubuntu on same laptop. I can't try OBS on the Pixelbook as the linux container functionality there does not yet supported access to usb devies within the containers.

Interesting thing is that in Chrome on Ubuntu and on the Pixelbook, using the live demo for WBS the UVC device does show up in the list of available audio/video sources, but if selected, the video feed that is displayed is actually just for the builtin webcam not from the UVC source.

I suspect this is a bug in Chrome, but wanted to raise this here in case this is due to a bug in WBS, before I went ahead and filed bugs reports in the Chromium bugtracker.

maks avatar Sep 19 '18 02:09 maks

Can you verify that the problem device isn't present in the array printed by this code:

window.navigator.mediaDevices.enumerateDevices().then(devices => console.log(devices))

t-mullen avatar Sep 19 '18 14:09 t-mullen

Sorry, is the issue that you can see the device in the sources list, but the feed is from the default camera?

t-mullen avatar Sep 19 '18 15:09 t-mullen

Yes, sorry I didn't make that more clear. That's exactly it, I have 2 UVC devices, they both show up in the sources list but selecting them just displays the built-in webcams actual video content.

maks avatar Sep 19 '18 21:09 maks

Alright, let's make sure WBS isn't just grabbing the wrong stream. Get the device ID of the UVC device with the above snippet, and plug it into here (with dev console):

DEVICE = '78da83489276ec70f0068cba07fa4b6d797afd8b131017f72f11cb4308980ef8';  //<-- deviceId

window.navigator.getUserMedia({audio:{exact:DEVICE}, video:{exact:DEVICE}}, (stream) => {
  var vid = document.createElement('video');
  vid.srcObject = stream
  vid.controls = true
  document.body.appendChild(vid)
}, (err) => console.error(err))

If the created video element shows your UVC stream, we know it's just a logic bug. Otherwise, we have a nice way to reproduce with Chrome.

t-mullen avatar Sep 19 '18 21:09 t-mullen

Thanks. I don't have access to the devices at the moment so I'll try this once I have them again tomorrow.

maks avatar Sep 20 '18 07:09 maks

Sorry to take so long to reply, I didn't have access to my gear for a little while. In the meantime I got a simpel uvc webcam (Logitech c270) which demonstrates exactly the same issue I was seeing wit my other devices.

I've done some tests with the snippets above and it shows the same (first video src) each time, despite using a different videoinputs deviceId.

However I have been able to hack up a version of the webrtc sample demo which does allow me to ahve both video inputs displaying in separate

I'll keep investigating more the next time a have a chance.

maks avatar Oct 21 '18 07:10 maks