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

#632 broke ability for site to say "give me first device" even in Firefox #649

Closed
jan-ivar opened this issue Dec 5, 2019 · 4 comments
Closed

Comments

@jan-ivar
Copy link
Member

jan-ivar commented Dec 5, 2019

With #632 enumerateDevices() filters out all but the first camera and first microphone.

But it also filters out the deviceId which I think is a mistake. This will break someone doing this:

const devices = await navigator.mediaDevices.enumerateDevices();
const exact = devices.find(({kind}) => kind == "videoinput").deviceId; // use 1st cam
await navigator.mediaDevices.getUserMedia({video: {deviceId: {exact}}});

I think this is a legitimate use case where the site explicitly wants to choose the first device (which is guaranteed to be the system default) for the user. This is the only way to avoid a selector in Firefox, and my plans in #644 (comment) rely on this.

A default deviceId could easily be provided, without leaking any information, and would avoid breaking the above code.

cc @youennf

@youennf
Copy link
Contributor

youennf commented Dec 5, 2019

Removal of deviceId was done by design and was agreed at TPAC IIRC.
Goal is to remove as much information as possible before the prompt.
Plan is, if backward compatible to have enumerateDevices return an empty list which would further break this use case.

Usually websites want to reuse the same device as previously, in that case {video: {deviceId: {exact}} should work.
If they do not have that information, I would think they would want to do something like {video: true} which should give them in most cases the default device.

It is not clear to me why websites would like to/should be able to opt-out of the selector, especially if the selector is well made.

If we really want to support that use case, we could add a new constraint or add a specific 'default' deviceId so that {video: deviceId: {exact: 'default'}} would give what you want.

@jan-ivar
Copy link
Member Author

jan-ivar commented Dec 6, 2019

add a specific 'default' deviceId so that {video: deviceId: {exact: 'default'}}

I like that idea. It would need to be standardized though, since sites may rely on it even without ever seeing it from enumerateDevices().

@jan-ivar
Copy link
Member Author

jan-ivar commented Dec 6, 2019

It is not clear to me why websites would like to/should be able to opt-out of the selector

Since this is the current model in all browsers except Firefox, it presumably has other advocates? 😉

Today, it lets sites that feel strongly about consistent user experience across browsers force a "default first, choose later" experience across all browsers, even Firefox. Is that not valuable?

Sites already have the power to pick for their users on re-visits (among choices they've made in the past) so I don't see an immediate problem with sites having the ability to force the system default on initial visit.

Since the getUserMedia API today already has this expressiveness (at least it had before #632), I see no reason to remove it.

But primarily, this is sugar on #644.

@jan-ivar jan-ivar changed the title https://github.com/w3c/mediacapture-main/pull/632 removed deviceId from filteredList #632 broke ability for site to say "give me first device" even in Firefox Jan 13, 2020
@jan-ivar
Copy link
Member Author

I'm going to close this since I opened it and I've seen no interest in suppressing the device picker in Firefox.

Mediacapture-Main to PR automation moved this from To do to Done Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants