-
Notifications
You must be signed in to change notification settings - Fork 61
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
Clarify when the application can retry getUserMedia after it returns "InvalidStateError" due to the window not being in focus #763
Comments
We would like to be able to add user gesture restriction to call getUserMedia, like we did for getDisplayMedia. |
Thanks for the suggestion. Some followup questions: Assuming the user gesture requirement change refers to w3c/mediacapture-extensions#11 and the definition of user gesture refers to transient activation in the getDisplayMedia spec:
The specific scenario I'm thinking about is this:
|
@q-alex-zhao I think there's some confusion. Not having focus never produces
This sentence is not about focus, but about calling getUserMedia() in a discarded browsing context. |
Instead, the relevant language for focus is in getUserMedia: "The User Agent MUST wait to proceed to the next step until the relevant settings object's responsible document is fully active and has focus." modulo #752 |
Ah sorry about my confusion. The The only drawback I can think of is that the application would not be able to separate the "user time" spent during the waiting for focus period, from the "system time" from actually doing the work opening the device, which the application may want to aggregate as part of product health metrics. But on the other hand |
The media capture spec says:
From whatwg/html#6211, the internal logic for the window being visible and focused would not be exposed to the application. So I think the application should not depend on
document.hasFocus()
returning true to assume it's good to callgetUserMedia
to begin with; it should always just callgetUserMedia
and inspect the result.My naive question is when the application may retry
getUserMedia
after receiving this "InvalidStateError", e.g. for showing a preview video before joining a meeting. Just periodically?The text was updated successfully, but these errors were encountered: