-
Notifications
You must be signed in to change notification settings - Fork 189
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
How to use this with Firefox? #12
Comments
To be honest I don't know if it is possible to specify which ALSA device FF should use. For example, there is an option for chrome-based browsers (e.g. chromium, opera) which allows to specify ALSA device:
If there is no way to set such an option (via command line, about:config page, or add-on), you can set bluealsa as a default ALSA device, as follows:
However, I'm not recommending this - at least not now. Currently, bluealsa is not able to handle more than one audio client and the Regardless of the above, I've just tried to play HTML5 video using FF and.... there is no sound. I'm using FF 45.5.0. Connection with the bluealsa server works fine (FF uses the default ALSA device), however it seems there is a bug in the bluealsa PCM plugin. I will have to check it. It looks like a deadlock related to the alsa-lib >= 1.1.2 (mentioned in the readme - troubleshooting section), but I'm not sure, since I'm using alsa-lib-1.0.29. You may try this approach (setting bluealsa as a default device) by yourself, but you may hit the same issue as I did. |
There is the multi plugin, see http://alsa.opensrc.org/TwoCardsAsOne for an example. This would copy all audio to all slaves. Would that work @arkq? |
Thanks for the answer!
I did that already :) Sadly it did also not work for me. I was not sure though whether that was because something was blocking the device or whether it does not work at all. |
@infirit, it seems that the multi plugin is for quite a different purpose. It combines many devices into one, nothing more. The problem with connecting more than one client is different. In order to play multiple streams through single device, one has to mix audio signals - hence the dmix plugin name. It is not a new problem. Every hardware sound card has to overcome it. So, ALSA guys have created mixing plugins for sounds cards which lack mixing, but these plugins are tailored for hardware devices. So, right now I'm not sure how should I proceed. The easiest way, it is to implement mixing within bluealsa PCM plugin (based on dmix). However, this will bond bluealsa server and PCM plugin very tightly and I don't want that. The other approach is to mix signals within bluealsa server, but it will require slight refactoring. So, I've decided to postpone this feature until bluealsa-1.2.0 will be released. For this to happen I have to fix #8, #10 (hopefully) and this FF issue :) |
Well, you have two output devices and a new pcm output that send all audio to both the normal audio card and to bluealsa. Sounds (no pun intended) like a reasonable solution to this issue. Here is another example of someone with 2 audio cards one for normal speaker and another for his headphones. The only difference being for this issue is that we are dealing with a bluetooth headphone. http://www.6by9.net/output-to-multiple-audio-devices-with-alsa/ |
Hmm... maybe it is indeed worth a try. However, my guts tells me, that connecting more than one client will still require mixing... I will check it maybe tomorrow, or during the next week. |
@onli, I've managed to partially overcome the issue with Firefox. Now, audio should start correctly. However, there is still a problem - it seems that the audio is going out of sync, and Firefox is trying to resync, which produces audio glitches (samples are lost). I've pushed this commit already, because right now it is "possible" to watch vlogs. Unfortunately, watching everything else is still problematic (especially music videos...). |
Thanks for working on that. I tried to test it. Downloaded the source current git master, compiled, replaced my bluealsa-binary in /usr/bin/ with the one that got compiled (so there might have been an issue introduced by compiling manually this time, and not via the ebuild). Restarted bluealsa, reconnected the headset, restarted firefox after in the .asoundrc bluealsa was set as default – and it does not work for me. I get this error when trying to play something with aplay (that worked before swapping the binaries):
Just to report back. Of course also possible that just the bluetooth system is not working properly right now and it would work after a restart, wouldn't be the first time. If not getting suggested otherwise, I'll test again when this ends up on my system via portage. |
OK, but bluealsa server is only a part of the whole bluez-alsa. You have to overwrite all files, otherwise you might end up with API incompatibilities. And for the record, the change I've made for Firefox was in a ALSA PCM plug-in :) Simple
And then, restart bluealsa service. PS. |
Thanks again for your work :) |
No problemo :) |
Sure, least I can do. So, I uninstalled bluez-alsa, pulled the master and compiled, this time with make clean, make, make install. Then starting bluealsa, setting the pcm.!default to it and connecting the headset. My .asoundrc looks like this:
It does not work for me. The audio element in FF, like before, gets stuck when pressing play. Youtube videos play, but without sound. This is the console output after FF starts:
aplay does work (I can't properly control its volume, but that's another story). I'm on FF 50.1.0. If I can help debug, just tell me how, I'll take the time. |
Damn...
The output from the bluealsa seems to be OK as well. However, it is not very important (I think). The important stuff in in the output from the firefox itself. I've just downloaded FF 50.1.0, and everything works fine:
Try to use |
I'm getting this (also just playing a Youtube video):
Will now try with the other .asoundrc. |
OK, the problem is with .asoundrc, just checked. You have to use |
Great, we're getting there! With your .asoundrc youtube (https://www.youtube.com/watch?v=7mXg9Vkd3OE) works. What does not work is the audio element. I'm using a software of mine as media player, https://github.com/onli/music-streamer. Clicking on play there still lets the audio element stay stuck, it is using a normal html5 audio element, and normally works. If you need a test-case, I could make you an account on my installation. The strange thing is that http://hpr.dogphilosophy.net/test/ does work. Edit: And yes, I tested that properly: The moment I remove the PCM switch to bluealsa and restart firefox, music-streamer is working again. No idea :/ |
There is a limitation in a current bluealsa version. It is not possible to stream more than one autio at a time. If something is not working, check for the debug output like this (from the audio application, e.g. firefox):
You've lost me there completely :) Does music-streamer work without |
It should be only one audio element. This seems to be the related output in FF:
But I do see the "device busy" line when it got stuck at the audio element and then trying to play a youtube video at the same time. So I think this is another bug (At first I thought "yes, that will be it", but then remembered that I removed the code that generates multiple audio elements at the same time last year, it is only one single audio element). But if you want, I can revisit this later when mixing works? Seems like a strange bug that defies logic, maybe doesn't need to have highest priority.
I worded that complicated. I meant emptying the .asoundrc, so FF uses the normal audio system again. Like, switching away from bluealsa. |
+1 for dmix |
I want to directly apologize, I'm aware that this issue might be offtopic.
BlueALSA on its own is working great on my system, but to be really useful I would need a way to let it play html5 audio over Firefox. I was unable to find a alsa-configuration or tool support to get the sound of Firefox to the bluealsa plugin. Is there a known or coming solution for FF, or is that something that would need support in the browser?
The text was updated successfully, but these errors were encountered: