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

Can devicechange fire prior to enumerateDevices? #956

Closed
fippo opened this issue Apr 20, 2023 · 2 comments
Closed

Can devicechange fire prior to enumerateDevices? #956

fippo opened this issue Apr 20, 2023 · 2 comments
Labels

Comments

@fippo
Copy link
Contributor

fippo commented Apr 20, 2023

I'm looking at a Chrome bug report and noticed I dislike the current behavior from a privacy point of view.

Does devicechange fire if the application never called enumerateDevices?
The argument for "no" is "you don't know what devices were available so why do you care about changes". It also means we have two vectors leaking device information instead of being able to focus on enumerateDevices (which is a big mess)

Firefox doesn't seem to fire devicechange prior to enumerateDevices from what I can see (@jan-ivar to confirm)

@youennf
Copy link
Contributor

youennf commented Apr 20, 2023

Does devicechange fire if the application never called enumerateDevices?

As per spec, I think so. For both APIs, the privacy protection is based on getUserMedia being called successfully.
Testing implementations, it seems that both Safari and Firefox are firing the devicechange event if getUserMedia is called but not enumerateDevices.
This might be somehow handy to know that the user's setup changed to offer some dedicated UI to the user although I agree the web page should probably call enumerateDevices beforehand to actually understand whether a device was added or removed

I am not sure what would be the privacy benefits for further restricting devicechange events, I would expect fingerprinters to call enumerateDevices anyway. One potential case would be setups that go from zero camera to one camera, but again, fingerprinters will call enumerateDevices.

@jan-ivar
Copy link
Member

Closing this as answered.

Testing implementations, it seems that both Safari and Firefox are firing the devicechange event if getUserMedia is called but not enumerateDevices.

Note that Firefox, Chrome, and the spec also fire the devicechange event ahead of getUserMedia() in the case where the number of cameras or microphones transition to or from zero (try it).

This may not be apparent on devices that have camera and microphone built in (I was unable to test Safari for this reason).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants