-
Notifications
You must be signed in to change notification settings - Fork 29
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
What is the relationship between toggle microphone/camera actions and MediaStreamTrack mute/unmute events? #307
Comments
This came up as part of w3c/mediacapture-extensions#39. |
To me, it makes more sense that the action callback is executed first and the mute/unmute events second. Maybe it would help for MediaSessionActionDetails to contain more information, something like:
The first bullet is also related to the question we have about how |
There is currently no relationship AFAIK.
I don't think this describes any browser today. I've confirmed this with this fiddle which reacts to the buttons in Picture-in-Picture mode (which end-users might be surprised to learn are chrome buttons). Tracks are never muted in Chrome (easily observed by commenting out the JS that clears Chrome is the only browser to implement |
That said, a UA COULD mute tracks here (since it can mute at any time), as I mention in #279 (comment). The first decision such a UA would need to make would be whether to trust the webpage to maintain the states, and simply enforce them with mute/unmute. Not trusting invites the double-mute problem. Trust doesn't seem like a big deal in the PiP example, but that might be deceiving, as many end-users might not even consider them chrome buttons in the first place. If we instead consider Safari's pause feature in the URL bar: ...then it seems less obvious that the webpage should control it. E.g. Safari might wish to A) keep it as a double-mute, or B) use heuristics on unmute based on how the user muted (from the web page or the chrome). To that end, it might be useful to fail the setters and return a promise to allow prompting. E.g. (proposal): // API modification proposal
try {
await navigator.mediaSession.setMicrophoneActive(true);
// unmute succeeded
} catch (e) {
if (e.name != "NotAllowedError") throw;
// unmute denied
} UAs might also take transient activation into account. |
That seems the most deterministic, since mute/unmute may fire for other reasons.
This might be helpful for a webpage that has gotten out of sync, but also seems redundant until I understand how they can get out of sync. |
@jan-ivar, I think we are mostly aligned, basically:
@steimelchrome, this is not exactly how Chrome is implementing these APIs.
I do not think this is mandatory to settle this particular point, we can discuss it as a follow-up once we agree on the interaction between track muted and media session API. Difficult to sync/Out of sync scenarios might happen with tracks being stopped in workers, setActive being asynchronous, and calling getUserMedia concurrently with these two. |
Discussed in today's media WG meeting.
|
Minutes from 9 January 2024 Media WG meeting: https://www.w3.org/2024/01/09-mediawg-minutes.html |
For VC applications it is necessary to know/specify what microphone or camera the event/action refers to. |
Filed issue #317 to track this. |
When the toggle capture action is executed, MediaStreamTrack muted state will change, which will fire mute or unmute events.
It would help to define whether the mute/unmute events are fired before or after the corresponding MediaSession action callback.
The text was updated successfully, but these errors were encountered: