1

I use Google meet in Chrome browser for online video meeting. In Google meet I can select my webcam in video devices. I can select any real hardware or virtual webcam and thats works well.

I am sure Chrome detect all real or virtual webcam see content of chrome://media-internals/

enter image description here

But MediaDevices.enumerateDevices() is only showing real hardware webcam and not showing virtual webcams.

<!DOCTYPE html>
<html>

<body>
    <script>
        (async () => {
            await navigator.mediaDevices.getUserMedia({ audio: true, video: true });
            let devices = await navigator.mediaDevices.enumerateDevices();
            console.log(devices);
        })();
    </script>
</body>

</html>

Hereis output of console in devtools:

[
    {
        "deviceId": "",
        "kind": "audioinput",
        "label": "",
        "groupId": "a71e32bec65bc4788683c156cfbc3c005bce4535b980209e4a455973bd93f36a"
    },
    {
        "deviceId": "",
        "kind": "videoinput",
        "label": "",
        "groupId": "03e0a9c9e71757f81bef3f3a74c4a56785b2d3d103a7de883101e509c233977f"
    },
    {
        "deviceId": "",
        "kind": "audiooutput",
        "label": "",
        "groupId": "a71e32bec65bc4788683c156cfbc3c005bce4535b980209e4a455973bd93f36a"
    }
]

How come Google meet and other websites are showing all camera including virtual camera and why MediaDevices.enumerateDevices() is not showing virtual camera?

Alok
  • 7,734
  • 8
  • 55
  • 100
  • the lack of a label in the enumerateDevices output suggests you don't have getUserMedia permission for some reason. Are you trying on something like a file:/// url? Try on a page like https://webrtc.github.io/samples/src/content/devices/input-output/ instead please. – Philipp Hancke Aug 25 '21 at 08:46
  • Thanks @PhilippHancke, you are right I was running html via file:// so I was seeing limited details but via http:// I am able to see all devices. Please post this as answer – Alok Aug 25 '21 at 09:20

1 Answers1

3

An empty label and only the default devices being shown in enumerateDevices after successful getUserMedia is an edge case that can only happen when testing on file:/// urls. It should work normally on https:// urls (and on localhost) where a successful getUserMedia call grants permission to the extended list of devices (see this PSA for details)

Philipp Hancke
  • 15,855
  • 2
  • 23
  • 31
  • Is there any workaround to to see extended list via `file:///` only? https://stackoverflow.com/questions/68920496/mediadevices-enumeratedevices-is-not-showing-all-the-media-devices-when-access – Alok Aug 25 '21 at 10:02
  • the --allow-file-access-from-files used to work but may no longer. – Philipp Hancke Aug 25 '21 at 13:58