I have a bluetooth soundbar attached to my TV. I'd like to use squeezelite running on my server (Linux) to play to this soundbar over bluetooth occasionally. Obviously, since the soundbar is used by the TV, I don't want to have the bluetooth connection permanently up; instead, I would like to initially pair the speaker, and then have the speaker "connected" over bluetooth whenever audio is sent from squeezelite, and to automatically disconnect when the audio stops.
After extensive searching, I've not been able to find a way to do this. Some possibilities would be to modify squeezelite itself to run a shell command (bluetoothctl connect XXX) whenever audio was streamed to it, or to somehow create a virtual pulseaudio device for the speaker, detect that audio is sent to it, run the connect command, and then send that audio on to the real bluetooth device. This might require some coding, and I'm not really very familiar with pulseaudio. It looks like there used to be an "autoconnect" option in /etc/bluetooth/audio.conf, but this no longer exists, as far as I can tell, and I'm not even sure that this would do what I want (it might be more about reconnecting to previously connected devices automatically, which isn't really what I want).
Any ideas or thoughts?
After extensive searching, I've not been able to find a way to do this. Some possibilities would be to modify squeezelite itself to run a shell command (bluetoothctl connect XXX) whenever audio was streamed to it, or to somehow create a virtual pulseaudio device for the speaker, detect that audio is sent to it, run the connect command, and then send that audio on to the real bluetooth device. This might require some coding, and I'm not really very familiar with pulseaudio. It looks like there used to be an "autoconnect" option in /etc/bluetooth/audio.conf, but this no longer exists, as far as I can tell, and I'm not even sure that this would do what I want (it might be more about reconnecting to previously connected devices automatically, which isn't really what I want).
Any ideas or thoughts?