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

Is reverting to different speakers from a background tab a valid use case? #129

Open
jan-ivar opened this issue Jan 25, 2022 · 1 comment

Comments

@jan-ivar
Copy link
Member

The spec says "When the audio device ... is no longer available, the user agent must take no action".

@alvestrand wrote in w3c/mediacapture-main#842 (comment):

The interesting version of devicechange with backgrounded tabs is if someone unplugs his headset while the tab is backgrounded, and expects sound to automagically switch to speakers without having to foreground the tab first.

JS can't intervene if backgrounded, since enumeration may not work (enumerateDevices "MAY ... wait ... until ... focus"), so there's no general solution for this. Even worse, there's a solution in some user agents but not others.

But is this behavior desirable? The VC use case from a private office makes sense. OTOH, someone passively attending from a library worrying audio might start blaring out of their laptop speakers should their headset accidentally disconnect, seems undesirable.

@alvestrand
Copy link
Contributor

I think Jan-Ivar's comment points out that the platform will be unable to confidently switch output devices on its own, so it seems that if we switch at all, we need to punt the choice of how to switch to JS.

One solution would be to define that a change in an output device that is in active use acts like a substitute for focus in the permission-gating algorithm, so that the signal gets fired and the enumerateDevices works within the callback from that signal.

This could get messy fast.

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

No branches or pull requests

2 participants