Open Bug 928644 Opened 6 years ago Updated Last year
Option to change audio output device when playing audio/video
Currently there's no way to change audio output device at all. When Firefox is launched it will use Windows default audio device and it's not possible to later change it to other. And worse is that seems #519828 isn't fixed, atleast it doesn't work for me. Searching on web can find various posts about wish for such feature, for example https://support.mozilla.org/en-US/questions/969042 So I propose to add option to Firefox settings where can change audio output device at any time. It should be drop-down menu with all output devices, such as it's for Skype http://imgur.com/gTXikKo Also there should be one option to use Windows default output device. Another very useful thing would be to allow user change audio output device per each HTML5 <audio>, <video> tag so for example if I've 2 songs playing on same webpage I could assign each it's own output device.
Actually bug 913804 is more relevant and it's what I thought with bug 519828 just didn't read it carefully.
I took a look at this and found that Firefox uses libcubeb for audio and it doesn't provide any support for changing audio device other than default so it should be implemented there first. Also FF uses WebRTC library which implements full support for audio devices, but since it's internal API I guess it can't be used and will have to be reimplemented in libcubeb. Another thing I saw is that there's AudioSession class (widget/windows/AudioSession) but it seems to be used for only plugins.
I experience the same problem, that is, I would like the audio device in FF to be changed as soon as I change the OS (Win 8.1) default audio device. It does not work in normal FF, but most interestingly it does work in the 64bit Nightly version of FF. (This is why for now I am using this, but since it is a 64bit version, I have some of my plugins not working, which is why I would prefer to be on the 32bit FF release.)
That's bug #698079 about which you're talking and it's really bad it's not fixed yet. This bug #928644 is about feature to allow changing audio output independently, like per tab or even per <video>, <audio> element.
This functionality is missing on linux as well. I sure would like to be able to plug in my USB headset and use its speakers and mic for webrtc calls, without having to fiddle with OS settings and restart firefox.
As Firefox gets more and more used as a media player as well as a web browser, having basic media player functions like this one becomes essential. If I want to play YouTube videos on my projector+sound system I need this.
This API is critical to providing a good in-app user experience since the alternative is for users to hunt down the OS device settings, which is not intuitive based on our experience and based on the feedback we've received from our app users. The Chrome Audio Output Devices API has been GA for about a year since Chrome 49 (https://bugs.chromium.org/p/chromium/issues/detail?id=547091). Any plans to support this in Firefox soon?
Considering Java is about to be disabled, audiooutput "kind" in enumerateDevices, as well as everything needed to pipe received WebRTC audio through to any chosen audiooutput device should get bumped up in priority. I understand that this is going to require pretty much a rewrite based on above comments about using a third party library (libcubeb) that doesn't support the required functionality. Maybe whoever chose to use libcubeb for audio output made the wrong decision, or a decision that was only good for the time. Looking at their github, they seem focused on audio input, not output. There should be a plan for this. It should have been implemented before considering NPAPI to be useless (per your dev team's blog posts about NPAPI, yes, everything is replaced with w3c spec'd APIs. Now you just need to support them properly.) The lack of any capability to ensure that one's audio output device is synchronized to their input device is why our organization didn't release WebRTC support for Firefox two years ago. I'm shocked that you still don't have it. We're going to have to unlist Firefox as a supported browser now, as much as I hate to impose browser constraints on to our customers.
On linux the browser audio appears as pulse audio stream that one can move using pulse mixer. Not sure how things work on windows and mac though. Also no idea about sync input and output. How should one test this?
(In reply to Alexander from comment #9) > On linux the browser audio appears as pulse audio stream That is extremely new behavior that just appeared in firefox 52. Some distributions have not disabled ALSA in their firefox builds. Some users cannot use PulseAudio at all. Therefore, pushing this issue off to PulseAudio is not a reliable / consistent solution.
@Forest, I am not against adding more functionality to Firefox but drawing the situation so badly is unreasonable IMO. I believe any version of firefox (and any other application) does create a new stream in pulse. I am using ff 51 ATM and I see a separate stream in pulse mixer for each youtube video I start playing. I can switch outputs dynamically using pulse mixer. Most distros do use pulse by default. I've been personally resisting pulse for years and I've been able to redirect FF audio output using environment variables: https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#Select_the_default_PCM_via_environment_variable Also if a USB card is plugged, at least on my distro (fedora but IIRC debian also that I used in the past) it became the default. So newly opened streams ended up on the plugged-in card. Yes, this is not dynamic but is an option for people that want to resist pulse (and I haven't had any issues with pulse (unlike during early introduction) for years. Last time I looked at some windows machine, it seemed to control audio streams per application in an audio server like approach. Is it possible to switch output per app in windows 10? I will not talk about windows though as I don't personally use it. wrt WebRTC, there is a service called Bluejeans that I use via Firefox 51 WebRTC implementation. So it seems to be working at least on linux. Again, I'm not against adding such features. It can be really useful especially for people using external sound cards and plugging-in them late (e.g. after call begins). But please be fair when blaming firefox. I think pulse can be patched to switch existing streams to newly added cards. But I'm not sure I would be happy with my streams switching on their own discretion.
(In reply to Alexander from comment #11) > drawing the situation so badly is unreasonable IMO. I have not drawn the situation badly. I have stated easily verifiable facts: 1. PulseAudio output replaced ALSA in official Firefox linux builds as of version 52, which only just began to reach users of major distributions (e.g. Ubuntu) within the past few days. 2. In order to avoid breaking working ALSA-only systems, some distributions have responded by building Firefox with the non-default flags the revert this change. Arch Linux is one example. 3. PulseAudio is not viable for some users. Each of those facts individually means that a PulseAudio-dependent "solution" for this issue would only work for a subset of users. In other words, not a true solution. > Most distros do use pulse by default. And most light bulbs are off by default. And most digital clocks blink 12:00 by default. People change defaults all the time. > Also if a USB card is plugged, at least on my distro (fedora but IIRC debian also that I used in the past) it became the default. And on my system, it doesn't. Your personal experience is not representative of everyone else's, and neither is mine, so it's important that we account for these differences when coming up with a fix for a common problem. That's all I'm saying.
This would be a good feature, e.g., for game streaming and other situations when you are recording what gets sent to the default device. Especially games rarely seem to have controls for where their audio goes, Windows is no help at all, so any piece of software one may need to use on the side providing diversity is good.
Might be worth pointing at bug 934425 which gives web pages the ability to set the output device. Not sure if that is a duplicate of this one, as setSinkId won't provide the user with a general overwrite for the system default output device.
See Also: → 934425
You need to log in before you can comment on or make changes to this bug.