Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is enumerateDevices list order significant? #608

Open
youennf opened this issue Jul 16, 2019 · 4 comments

Comments

@youennf
Copy link
Contributor

commented Jul 16, 2019

Some OSes allow users to set the default microphone.
Looking at Safari, Chrome and Firefox on MacOS, the first audioinput device in the list is the default system microphone. Chrome and Firefox try to convey that this is the default one using labels/deviceIds.
I do not know of any 'system default' for camera but the same principle could be extended to videoinput devices.

Should we describe this behaviour in the spec?

Also, if calling navigator.mediaDevices.getUserMedia({audio: true, video: true}), is it expected that the first audioinput and first videoinput devices be selected?

@armax00

This comment has been minimized.

Copy link
Collaborator

commented Jul 18, 2019

In reply to the second question, I have the suspicion that it is indeed the case that if only selecting true for both, one would end up with the default device because is the device with "best fit" in such a case than any other device.

With respect to the first question, would formalizing that behavior bring something to the developer that otherwise was not already available? What I mean is that if the developer can select the default device explicitly already using "deviceId", is it useful to explicitly mention in the API that the default device is the first that is shown in the list of enumerateDevices?

@eric-carlson

This comment has been minimized.

Copy link

commented Jul 18, 2019

In reply to the second question, I have the suspicion that it is indeed the case that if only selecting true for both, one would end up with the default device because is the device with "best fit" in such a case than any other device.

Why is the default device necessarily the "best fit", unless the spec says so.

What I mean is that if the developer can select the default device explicitly already using "deviceId", is it useful to explicitly mention in the API that the default device is the first that is shown in the list of enumerateDevices?

The developer can only select the default device explicitly with 'deviceId` if they know the id of the default device. How do they do find the id of the default device?

@youennf

This comment has been minimized.

Copy link
Contributor Author

commented Jul 18, 2019

Why is the default device necessarily the "best fit", unless the spec says so.

Yes, the spec does not talk about best fit.
The spec says that "User Agents are encouraged to default to using the user's primary or system default camera and/or microphone (when possible) to generate the media stream".
If the default camera/mic are first in the enumerateDevices list, everything seems more consistent.

With respect to the first question, would formalizing that behavior bring something to the developer that otherwise was not already available?

Some web developers are interested in picking the default system device (at least the default microphone) and they have to use different approaches in Chrome, Firefox and Safari.
One straightforward way of helping developers which does not seem to require any change in browsers is to use the order in the list for this purpose.

If we expose this 'default device' information, the follow-up question is whether a devicechange event should be fired when the default device is changing, like when the user went to the system UI to change the default microphone.

Another related question for browsers exposing a 'default' microphone device is whether, while capture is ongoing with the default microphone and the user decides to change the system default microphone, the browser should change or not of actual microphone for the ongoing capture.
This question is probably outside the scope of the spec.

@alvestrand

This comment has been minimized.

Copy link
Contributor

commented Aug 15, 2019

Some platforms have multiple default devices (Windows: Comms device / media device).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.