Using LibreElec as a bluetooth receiver

  • I'm trying to use my Odroid C2 with LibreElec as a bluetooth receiver for my phone, so I can pull up my streaming service of choice on the couch and listen on my home A/V receiver. I have been, for the past two weeks, doing this by pulling out my laptop. I followed the initial steps here: Pulseaudio [LibreELEC.wiki] for audio receiving, and it worked. for the next week, I didn't turn off my kodi box, and used it to stream music. I didn't use Kodi to watch anything in that time, and I disconnected and reconnected my phone, and then it no longer functioned. I followed the directions again, and found that simply by having my phone be on with bluetooth, and using

    Code
    systemctl stop kodi

    and then loading the pulseaudio udev module

    Code
    pactl load-module module-udev-detect

    the music would begin streaming again.


    This still required me to pull out the laptop, ssh in, and do it everytime I wanted to listen to music after restarting kodi, having my bluetooth off on the phone, or after watching another source on Kodi. This morning I decided to make an autostart script. Following the directions in the wiki, I placed a file called autostart.sh in /storage/.config, and in that file I placed

    Code
    #/bin/sh
    pactl load-module module-udev-detect
    done


    Currently, if my phone is bluetooth on, and I reset the Odroid C2, I can then go into Kodi>Settings>Bluetooth and connect to my phone and streaming works. Kodi has no system sounds at startup (which maybe helpful, but I don't care about the lack of sounds). If I turn off bluetooth on my phone, watch another source, etc, then GUI sounds return to Kodi, and I'm not longer able to stream from my phone.


    It seems that KODI is "grabbing" pulseaudio away from the bluetooth source. Rebooting is quick enough, and I've suceeded in eliminating the need to boot the laptop for an ssh session, but is there a way to do what I want to do better, cleaner, faster? :) I'd like to just be able to stream to my LibreElec box anytime my phone is paired. Is there a way to tell Kodi to not grab the audio input of LibreElec if no other sources are playing?


    Thanks for any help, and hopefully this helps anyone else trying to do the same in future!


    Edit: if I turn off GUI sounds by telling kodi to "never" use them, and disconnect and reconnect from my phone in System settings>Kodi>Bluetooth, I can stream again. I'm going to leave this post for others who maybe have the same question, and also because if others do the same thing in a more effecient say (stream bluetooth to kodi) I'd love to hear how. If that's inappropriate, I'll delete the post.

    Edited once, last by d557charger (March 21, 2018 at 5:20 AM).

  • Go to Best Answer
  • Hello,

    I tried your little autostart script and it worked :) However, the sound is terribly overamplified and clipped, even at the lowest possible volume level from my bluetooth-audio source (my smartphone). I haven't found a volume knob for pulse audio so far.

    I removed the autostart script and rebooted but unfortunately all audio output sounds clipped now.

    In

    Settings > System > Audio > Audiodecoder

    the uppermost line

    Audio Output Device Default, Bluetooth (Pulse Audio)

    is greyed out. How can I turn back to Default (ALSA)?

    Any hints appreciated.

    TIA

    Edited once, last by Digitalis (November 3, 2018 at 10:58 AM).

  • Have you found a smarter solution to the problem? I came to the same situation as you. I'm trying to connect google home to my Raspberry pi.

  • I have found that I don't need to stop Kodi, I can just run

    pactl load-module module-udev-detect

    and Bluetooth works as described in the first post.


    Can't get auto start to work though, just gives me glitches.

  • jmi Try this autostart.sh:

    Bash
    #!/bin/sh
    
    (
    	sleep 5
    	pactl load-module module-udev-detect
    ) &

    autostart.sh starts before Kodi, so after sleeping some seconds in background, Kodi should run.