-
Notifications
You must be signed in to change notification settings - Fork 25
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
Setting the audio output for a whole context or page #87
Comments
This somehow relates to #63. |
Actually no. You might want to have the "ring" sound to go to the speaker (so you hear it if you are not at your desk) while during the call you want to have sound going to your headset. Arguably you might want in-call notification sounds to go to your headset too then. |
If the user is not interacting/interested in the web application, the application is probably not in a position to select the proper means to request user interest. For instance, you might want the device to vibrate instead of playing a ring tone if the device is in vibration mode, but you probably do not want to let the application know you are in vibration mode. On the other hand, if the web application knows the user is interacting with the page, like in the middle of a phone call, it seems natural to use the same speaker device. I agree though that there are use cases for multi speaker setup cases (hence why HTMLMediaElement.setSinkId is good to have too). These use cases might not be as common, hence why it might be useful to have a page-wide version. |
Web audio seems easy enough to work around. Instead of: audioNode.connect(audioContext.destination); you'd do const dest = audioContext.createMediaStreamDestination();
element.srcObject = dest.stream;
audioNode.connect(dest); Not sure about audio worklet though.
The workaround is to collect all elements and set them: async function setAllElements(sinkId) {
const elements = [...doc.getElementsByTagName("audio"),
...doc.getElementsByTagName("video")];
await Promise.all(elements.map(element => element.setSinkId(sinkId)));
} |
This is not working for third-party iframes. |
I got here while trying to get this to work now in chrome, and if something like a whole page default can simplify how changing a device is done now, it would be very nice. I'm really just playing around, so take it with a sack of salt, but OTOH there's generally a lot of confusion on the interwebs. The thing that tripped me is that if you |
Currently, we are only able to control individual HTMLMediaElement audio output with setSinkId.
We probably need to add something to WebAudio as well.
In most cases, it seems that pages will want to output all their audio to a single device.
Adding such an API to do so would be convenient and would complement setSinkId which would be used to override this default value.
Something at navigator.mediaDevices level might make sense.
The text was updated successfully, but these errors were encountered: