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

Should getUserMedia promise be resolved only on pages that have focus #560

Closed
youennf opened this issue Jan 23, 2019 · 3 comments
Closed

Comments

@youennf
Copy link
Contributor

youennf commented Jan 23, 2019

Safari currently does not resolve/reject a getUserMedia promise until the view is visible.
This allows to start capture on a page that the user has access to.
Should this be mandated in the spec?
The same question might apply to enumerateDevices.

@jan-ivar
Copy link
Member

Firefox has this behavior as well. Turning on camera/mic from a background tab is creepy.

This might even be something that could go in the permissions spec.

Having prompts appear from background tabs is generally a UX security issue.

enumerateDevices() does not require permission, so I'd treat that as a separate issue I think.

@youennf
Copy link
Contributor Author

youennf commented Jan 25, 2019

Having prompts appear from background tabs is generally a UX security issue.

Right, Safari is not resolving getUserMedia promise even in the case where no prompt will be shown to user (say user granted persistent access to this website).

One could think of relaxing this rule in case the device is already capturing.
But that can probably be emulated with clone+applyConstraints so I am not sure this is worth optimizing.

I guess the idea would be to postpone the whole getUserMedia process starting at step 6 until page has focus.

@jan-ivar
Copy link
Member

jan-ivar commented Jan 25, 2019

Safari is not resolving getUserMedia promise even in the case where no prompt will be shown to user (say user granted persistent access to this website).

Firefox has the same behavior. Testing with this fiddle in two tabs, Chrome and (early) Edge do not. @alvestrand @henbos @aboba thoughts?

relaxing this rule in case the device is already capturing. [ = clone+applyConstraints]

I agree. (Too hard).

I guess the idea would be to postpone the whole getUserMedia process starting at step 6 until page has focus.

I can submit a PR for discussion. Then we can argue over MAY, SHOULD or MUST, if we like this.

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

No branches or pull requests

2 participants