Bug 1723703 Comment 5 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I see what's happening. Firefox grants per-device permission, and bug 1443294 regressed a *really* basic case (needs [two cameras](https://jsfiddle.net/jib1/9eqc3kjt/) or [two mics](https://jsfiddle.net/jib1/ywv186dq/)):
```js
const stream1 = await navigator.mediaDevices.getUserMedia({video: true});
const stream2 = await navigator.mediaDevices.getUserMedia({video: true});
```
If you pick something other than the default choice in the first prompt, then you get prompted again, with the same default choice as before (the one you didn't pick).

Is this wrong? Probably, because
 * chances are high the user didn't like the default,
* same results from same input seems least surprising to the app (especially since other browsers don't have choices in their prompts), and
* fewer prompts!

If you're here about a demo site, we're sorry about this regression and you can stop reading.

#### If you're here about a professional WebRTC site, please read on:

Pro sites should be managing devices for their users between visits, [like this](https://jsfiddle.net/jib1/e89jp3hv/):
```js
const stream = await navigator.mediaDevices.getUserMedia({
  video: {deviceId: localStorage.camId},
  audio: {deviceId: localStorage.micId}
});
localStorage.camId = stream.getVideoTracks()[0].getSettings().deviceId;
localStorage.micId = stream.getAudioTracks()[0].getSettings().deviceId;
```
If they do this, then this bug shouldn't happen.

What may be happening, is we've seen sites that provoke permission prompts early:
```js
await navigator.mediaDevices.getUserMedia({video: true}); // get the prompt over with
```
But this assumes the browser implements all-device permissions, which doesn't work well in Firefox. It's also a bad idea in other browsers since this may turn on the wrong camera briefly, causing its red hardware light to go on for 3-10 seconds, surprising the user.
I see what's happening. Firefox grants per-device permission, and bug 1443294 regressed a *really* basic case (needs [two cameras](https://jsfiddle.net/jib1/9eqc3kjt/) or [two mics](https://jsfiddle.net/jib1/ywv186dq/)):
```js
const stream1 = await navigator.mediaDevices.getUserMedia({video: true});
const stream2 = await navigator.mediaDevices.getUserMedia({video: true});
```
If you pick something other than the default choice in the first prompt, then you get prompted again, with the same default choice as before (the one you didn't pick).

Is this wrong? Probably, because
 * chances are high the user didn't like the default,
* same results from same input seems least surprising to the app (especially since other browsers don't have choices in their prompts), and
* fewer prompts!

If you're here about a demo site, we're sorry about this regression and you can stop reading.

#### If you're here about a professional WebRTC site, please read on:

Pro sites should be managing devices for their users between visits, [like this](https://jsfiddle.net/jib1/e89jp3hv/):
```js
const stream = await navigator.mediaDevices.getUserMedia({
  video: {deviceId: localStorage.camId},
  audio: {deviceId: localStorage.micId}
});
localStorage.camId = stream.getVideoTracks()[0].getSettings().deviceId;
localStorage.micId = stream.getAudioTracks()[0].getSettings().deviceId;
```
If they do this, then this bug shouldn't happen.

What may be happening, is we've seen sites that provoke permission prompts early:
```js
await navigator.mediaDevices.getUserMedia({video: true}); // get the prompt over with
```
But this assumes the browser implements all-device permissions, which doesn't work well in Firefox. It's also a bad idea in other browsers since this may turn on the wrong camera briefly, causing its hardware light to go on for 3-10 seconds, surprising the user.
I see what's happening. Firefox grants per-device permission, and bug 1443294 regressed a *really* basic case (needs [two cameras](https://jsfiddle.net/jib1/9eqc3kjt/) or [two mics](https://jsfiddle.net/jib1/ywv186dq/)):
```js
const stream1 = await navigator.mediaDevices.getUserMedia({video: true});
const stream2 = await navigator.mediaDevices.getUserMedia({video: true});
```
If you pick something other than the default choice in the first prompt, then you get prompted again, with the same default choice as before (the one you didn't pick).

Is this wrong? Probably, because
 * chances are high the user didn't like the default,
* same results from same input seems least surprising to the app (especially since other browsers don't have choices in their prompts), and
* fewer prompts!

If you're here about a demo site, we're sorry about this regression and you can stop reading.

#### If you're here about a professional WebRTC site, please read on:

Pro sites should be managing devices for their users between visits, [like this](https://jsfiddle.net/jib1/e89jp3hv/):
```js
const stream = await navigator.mediaDevices.getUserMedia({
  video: {deviceId: localStorage.camId},
  audio: {deviceId: localStorage.micId}
});
localStorage.camId = stream.getVideoTracks()[0].getSettings().deviceId;
localStorage.micId = stream.getAudioTracks()[0].getSettings().deviceId;
```
If they do this, then this bug shouldn't happen.

What may be happening, is we've seen sites that provoke permission prompts early:
```js
await navigator.mediaDevices.getUserMedia({video: true}); // get the prompt over with
```
But this assumes the browser implements all-device permissions, which doesn't work well in Firefox. It's also a bad idea in other browsers since this may turn on the wrong camera briefly, causing its hardware light to go on for 3-10 seconds, surprising users.

Back to Bug 1723703 Comment 5