[mediacapture-main] No way to reliably choose correct camera & microphone upfront (#656)

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

== No way to reliably choose correct camera & microphone upfront ==
Visit a new web site in Chrome, Safari, or Edge, & do something requiring camera + microphone:

<img width="1108" alt="image" src="https://user-images.githubusercontent.com/3136226/72219927-600ada80-3519-11ea-837b-07ea798d05d5.png">

They'll say the site wants to _"use your camera and microphone"_, without saying _which ones_ (USB webcams, headsets, modern phones https://github.com/w3c/mediacapture-main/issues/655). If it's wrong, you'll need to correct it after the fact.

Browsers may not even choose the same camera and microphone, a web compat issue (e.g. headset detection).

Firefox is different, showing which camera and microphone will be used, even letting you change it (within the constraints of the app):
<img width="300" alt="image" src="https://user-images.githubusercontent.com/3136226/72224132-ab86ae00-3544-11ea-94ee-aed34bc60763.png">

But not everyone with multiple devices use Firefox.

It would be better if users got to choose based on how many devices they have, not what browser they use, and maybe regardless of permission if an app is this indecisive on subsequent visits.

It also feels like this should be an app decision, not a browser trait.

**Proposal A:** https://github.com/w3c/mediacapture-main/pull/644#issuecomment-566248295 would fix this, prompting on indecision _or_ lack of permission. But it may not be web compatible at this point.

**Proposal B:** Add a new getUserMedia boolean that enables the https://github.com/w3c/mediacapture-main/pull/644#issuecomment-566248295 behavior:
```js
await navigator.mediaDevices.getUserMedia({video: true, chosen: true});
```
"chosen" means both tracks must be chosen by the user (or app), not the user agent.

In the interest of web compat, Firefox would remove its picker unless `chosen` is true, giving web users the same experience across browsers.

**Proposal C:** Same as B, but with new method:
```js
await navigator.mediaDevices.chooseUserMedia({video: true});
```

Incidentally, this would be the same API used to replace in-content device selection https://github.com/w3c/mediacapture-main/issues/652.

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

Received on Sunday, 12 January 2020 21:19:25 UTC