0

I created my local website for a magic mirror project. This project includes my google calendar, weather ifo, timers, internet radio, ...

For the timers and internet radio I would like to hear the audio through my bluetooth speakers. These are connected correctly. In an SSH window I'm able to playback a wav file through the speakers using:

  • aplay /usr/share/sounds/alsa/Front_Center.wav
  • sudo -u www-data aplay /usr/share/sounds/alsa/Front_Center.wav

This also works for user www-data (after adding this user to the audio group). But I can't manage to make the audio play from my webserver which is starting up in kiosk mode in Chromium.

Am I missing something? However, when trying to play back audio with omxplayer, this is also not working. When closing Chromium and starting up VLC player, the audi ois played through my bluetooth speakers.

EDIT: I got some extra info now. Just tried starting up my pi in kiosk mode, then shutting down Chromium (ALT-F4). When arriving on the desktop, I open a terminal to start chromium again in kiosk mode. Now the audio is working fine on the webserver. Could it be the order in which certain things are executed? Starting in kioskmode is executed from ~/.config/lxsessions/LXDE-pi/autostart: chromium-browser --noerrdialogs --kiosk localhost --disable-translate

  • "my webserver which is starting up in kiosk mode in Chromium" - That doesn't make sense. Webservers have nothing to do with Chromium (that's a web client), and they don't output anything on the screen so "kiosk mode" is also unclear. – Dmitry Grigoryev Apr 21 at 13:57
0

I have had a very similar issue, when I switch between VLC, Youtube and Kodi.

I believe you are correct in the order of loading for the audio to work over the Bluetooth speaker. Sometimes when I switch between the three above I have to do the following to get my Bluetooth working again:

sudo apt install pulseaudio-module-bluetooth
pulseaudio -k
pulseaudio --start

bluetoothctl
default-agent
scan on
connect XXXXXXXX

Also, anytime I want to use the Analog headphone jack I have to un install pulseaudio and disable Bluetooth to get it to work, then when I want to switch back I again have to run the commands above.

So in short, I would make a small script you can run to load things in the correct order that way you only have to worry about running one command and it will be right each time.

Hope this helps..

| improve this answer | |
  • My current workaround now: Each time I want to listen to music, I turn on my BT speaker, I shut down Chromium, I play a wav-file with aplay, I start up Chromium again and it's working :-) . I'm wondering if I got put this in some kind of python/bash script to execute this automatically from my magic mirror project. I'm also wondering if I have to restart Chromium to make this working. Trial & Error ... unless some other solutions are posted :-) – Kristof Boeykens Apr 17 at 8:19
0

I solved it with a small work-around. I have a jack-to-BT module (Avantree Priva III) laying around in the house. I connected an audio cable from the rpi jack port to the Priva and a USB cable to power the Priva from the rpi. Now the jack port is always connected.

I can now turn on/off my bluetooth speaker without problems. For the rpi there is always a device connected to the jack port.

Only disadvantage: I had to give up an extra USB port on my rpi.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.