[mediacapture-main] Default device selection and listing inconsistencies (#727)

guest271314 has just created a new issue for https://github.com/w3c/mediacapture-main:

== Default device selection and listing inconsistencies ==
According to the specification at `enumerateDevices()` 8.3 https://w3c.github.io/mediacapture-main/#methods-1

> If _device_ is the system default camera, prepend _deviceInfo_ to _cameraList_. Otherwise, append _deviceInfo_ to _cameraList_.

At `getUserMedia()` 6.5.1 https://w3c.github.io/mediacapture-main/#methods-5

> User Agents are encouraged to default to using the user's primary or system default device for kind (when possible). User Agents MAY allow users to use any media source, including pre-recorded media files.

However, there does not appear to be any definition of default system device or an algorithm to determine which device is in fact the default system device.

If we connect two (2) separate USB devices that have camera and microphone capabilities Chromium and Firefox return different default devices for `getUserMedia({video: true})` without further constraints, and _prepend_ the device to the list returned by `enumerateDevices()` to different indexes in the list, if in fact the a default device is found, which is not observable or verifiable by the user.

Code

```
onclick = e => navigator.mediaDevices.getUserMedia({video:true})
.then(async stream => {
   console.log(stream.getVideoTracks()[0], await navigator.mediaDevices.enumerateDevices());
   stream.getTracks()[0].stop();
});
```

Firefox 80

track:

`MediaStreamTrack { kind: "video", id: "<id>", label: "UVC Camera .." ..`

devices:

```
0: MediaDeviceInfo { deviceId: "<id>", kind: "videoinput", label: "UVC Camera ..", ..
1: MediaDeviceInfo { deviceId: "<id>", kind: "videoinput", label: "Digital_Camera ..", ..
```

Chromium 87

track:

`MediaStreamTrack {kind: "video", id: "<id>", label: "Digital_Camera .."`

devices:

```
1: InputDeviceInfo {deviceId: "<id>", kind: "videoinput", label: "Digital_Camera .."
2: InputDeviceInfo {deviceId: "<id>", kind: "videoinput", label: "UVC Camera .."
```

Firefox and Chromium are identifying two different devices as default, and prepend the connected devices to the _cameraList_ at different indexes. Both devices cannot be default at the same time. One implementation algorithm is incorrect, yet there is no way to determine that fact from the front-end. 

Language in the specification needs to be conclusive as to default device selection so that the same device is selected as default at each implementation and prepended to the same index at `enumerateDevices()`. The current language is obviously insufficient and useless, as there is no way to determine whether Firefox or Chromium is selecting the actual default system device.



Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/727 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 27 September 2020 18:43:43 UTC