https://www.sigmdel.ca/michel/ha/rpi/bl ... 02_en.html
This method is with ALSA and bluez-alsa:
https://github.com/Arkq/bluez-alsa
My speaker now automatically pairs and connects when turned on, so that part is good. To get it to actually play the audio stream, the guide recommends creating the following .asoundrc:
Code: Select all
defaults.bluealsa.interface "hci0"
defaults.bluealsa.device "30:21:3E:31:C6:2B"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000
Code: Select all
mpv --audio-device: alsa/bluealsa "mms://mediau.yle.fi/liveradiopuhe" # Finnish radio
The problem is, I want to run it headless, constantly streaming audio (if I want to listen to a different station, I can ssh into the Pi and change it). Then I turn my speaker on in the morning, without having to switch on the Salix desktop and get sucked into the internet and its distractions, and listen to the news in Finnish.
This might be rather like the sort of "plug and play" behaviour you see when using normal AV applications on the desktop - you plug in your headphones, and the loudspeakers go off, if they were turned on in the first place.
But what happens is, whichever player I'm using tries to buffer the stream, and complains tremendously, as soon as the speaker is turned off. Quite apart from that, the Pi expects the speaker to be connected before the stream is started. But then, I have to ssh into it and do it manually, which defeats the whole object.
Does anyone have any suggestions? I am reluctant to mess with the bluetooth part, which works - I tried every which way with pulse, and it was never successful.