Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Dec 2020
    Posts
    6

    Squeezelite playing to bluetooth device; connect on demand

    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?

  2. #2
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,227
    Quote Originally Posted by hbq269 View Post
    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.
    Try the Event Trigger plugin.
    Various SW: Web Interface | TUI | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | DB Optimizer | Image Enhancer | Chiptunes | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  3. #3
    Junior Member
    Join Date
    Dec 2020
    Posts
    6
    Quote Originally Posted by Roland0 View Post
    Try the Event Trigger plugin.
    Aha! This seems to work. I've set it to run a script on all playlist events, and it checks for the player id, and the player mode, and it runs "bluetoothctl connect ..." if it's not already connected and the player mode is "play". I need to experiment a bit to see if I want it to also disconnect when the player mode is "paused" - probably not, otherwise the connect/disconnect noise will be annoying every time you pause, and the TV will presumably take precedence over bluetooth when it's switched on anyway.

    It would be more elegant to have this handled at the pulseaudio level, but this solution gets me a working system. Thanks!

  4. #4
    Member
    Join Date
    Jan 2009
    Location
    Nuremberg, Germany
    Posts
    42
    Hello, sounds like a very interesting solution - could you post a short how to?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •