Posts by micro

    Then to get music playing over the USB sound card all I really had to do was run pactl load-module module-udev-detect. My sound card is detected and is set as the default sink instantly (I guess because it is the only sink available on my RPi2) and my Bluetooth streamed music starts playing over my speakers, yay! At the same time I can play anything using Kodi and Kodi's sound is passed through over HDMI while simultaneously streaming Bluetooth music, exactly what I wanted to achieve.

    To automatically detect my sound card at boot I added pactl load-module module-udev-detect to autostart.sh. Funny how that was really all I had to do to get my ideal setup working.

    Wow I have been wanting this for years. I found your post and it worked a treat.

    For clarity, I've been using Kodi on an RPI2 for years with a Creative USB sound card. Airplay has been mostly ok - but a bit unstable - and streaming from Android has been impossible.

    To get Android (and Apple for that matter) streaming to the RPI's Bluetooth, do the following:

    1. Pair the phone using Settings -> Libreelec -> Bluetooth
    2. Change the Audio output device to PULSE in Settings -> System -> Audio. When you change this the audio will stop working until the rest of this procedure is completed so don't be alarmed
    3. Get the network IP Address from Settings -> System information
    4. SSH into Kodi using the IP address and login with user root pw libreelec
    5. nano /storage/.config/autostart.sh
    6. paste the following:

      pactl load-module module-udev-detect
    7. Save the file (CTRL-X -> y -> [ENTER])
    8. Reboot the RPI
    9. Reconnect Bluetooth from your phone
    10. Start streaming from Spotify or any other app, as you would with any bluetooth speaker or headset
    11. You can still play audio as usual from Core or Yatse but if you are streaming at the same time, the audio will mix so stick to using one or the other at any given time
    12. Pros of playing from Core or Yatse are guaranteed audio quality and access to your library, playlists etc. Once you start playing audio your phone is no longer required; the music will play even if the phone leaves wifi or bluetooth range or is switched off
    13. Streaming via bluetooth is convenient. Downsides are that the phone must stream audio from the Internet as long as it is playing (meaning battery, bandwidth) and the phone must remain in bluetooth range or the audio will get choppy and eventually disconnect. Audio quality is not guaranteed as compression is likely. Sounds pretty satisfactory me my old ears though!

    I hope this helps other people who want to get this working. It really only takes a few minutes and has awesome payback. I'm unsure if the autostart.sh changes will survive an upgrade - time will tell.

    Happy me :)

    It's been almost a year since I last posted on this issue.

    The issue has only been a minor irritant since I stabilised my network connection to the RPi3 with an ethernet cable. Upgrading to LE v8.11 has further reduced the impact. I will explain:

    I believe what triggers this is not having the network available when Kodi starts. If you are on wired ethernet you can test this by:

    1. Turn off wifi.
    2. Shut down RPi.
    3. Unplug ethernet.
    4. Restart RPi [or just restart Kodi - see notes below]
    5. Once Kodi is running, reconnect ethernet and wait a few seconds for IP address assignment etc.

    At this point, the network connection works; for example, I can play music from the NAS, and stream Internet radio.

    Then I check my ipad - and yes, the RPi is listed under Airplay. However if I try to actually select it and stream to it, it doesn't work. Typically it just reverts back to the local ipad playing through its speakers after a second or two.

    Now this is the point where under LE v7, I would have had to disable Airplay, reboot and re-enable Airplay and all would come good (except for the odd time when the ipad got really confused and also needed a reboot).

    Under v8.11, however, all that is needed appears to be a reboot - no need to toggle the Airplay service - and that is a significant improvement.

    Then I tried forcing the condition and used the Keymap Editor addon to map a key that restarts Kodi without rebooting the device (side note: AFAIK this can only be done via keyboard map; I cannot find a way to restart Kodi without rebooting via the GUI). This worked! It got Airplay working again with just one button press and less than 10 seconds. That represents a huge improvement over the LE v7 situation.

    One final observation:

    During this testing I found another part of Kodi that consistently shows another symptom under the same circumstances, and that is the upgrade channel. If I follow the procedure above, up to point #5 above where Airplay is not working but prior to rebooting or restarting Kodi, and go to Settings -> LibreElec Settings -> System tab, scroll down to Available Versions and hit OK, the list of Available Versions is empty, i.e. none are listed even after I have confirmed that the network connection is working by playing music from the NAS. Once I restart Kodi with a stable network connection and go back into settings, the Available Versions list returns. This is consistent - both the Airplay and Available Versions issue happen every time I restart without a network connection, and remain broken until a reboot or Kodi restart.

    Unplugging the network cable after Kodi has started does not cause this; it actually seems quite tolerant of network interruptions. The critical time for the connection to be present appears to be at Kodi startup. In fact I just now tested the procedure listed above but in step 4 I restarted Kodi rather than completely rebooting the RPi, and was able to reproduce the issue even more quickly.

    If someone else can confirm this consistent behaviour then please do and perhaps we can lodge a bug report. It would be interesting to test the issue on other hardware platforms.

    But at any rate, the issue is much less painful once understood and with the 'restart Kodi' workaround available.


    Thus, this issue is not related to specific hardware and/or device. This is clearly a general bug.

    I tend to agree. astep - next time this happens, can you confirm that the steps I provided above temporarily resolve the issue?

    If so, it would seem there is a persistent (i.e. it survives reboot) state control related to the airplay listener that needs resetting under certain circumstances. Anyone out there with airplay knowledge who can shed light on this? I'm pretty sure I had the same issue under openelec.

    If anyone else is experiencing this issue please do post. Airplay audio is such a great feature and it is so close to being perfect.

    My experience is similar on RPi3 with LibreElec 7.0.2. Airplay audio worked on initial install but then randomly stopped working from all source devices. The airplay device shows as available, but selecting it either does nothing (ios9) or gives a connection error (ios10).

    Rebooting both the RPi and the source device makes no difference - once it stops working it stays in that state.

    UNTIL! Today I figured out how to get this working again. Turn off Airplay support in Kodi settings, reboot the RPi, then re-enable the Airplay service in Kodi settings. At this point source devices can select the Kodi as an Airplay device and it works.

    I'm still unsure why it stops working. Might have something to do with the source device (e.g. ipad) losing its wifi connection temporarily, as my house has too much brick which creates a few wifi black spots. The RPi itself is ethernet connected so that's not the issue.

    Would be great to make Kodi/LibreElec more robust in this respect. It's just a matter of time until it stops working again, so I'd be happy to provide any logs or take other troubleshooting steps if that would help.

    For now - at least I have a workaround that does not require reinstalling! I hope this helps others.