Librespot Add-on

    • Official Post

    Well yeah, he has it there, but I haven't installed it. Inputsteam.adaptive is the successor of inputstream.rtmp as far as I know.

    Here's the log, where you can see which add-ons are installed: eOYE There is no inputstream.rtmp mentioned.

    I tested on my RPi: the librespot works fine without any inpustream addon.

    So let us try to assess differently.

    First determine if the service runs correctly:

    Code
    systemctl stop service.librespot
    librespot.start

    Any errors?

  • Nice approach!

    here you are (errors indeed):

    During this my Android app showed that track is playing on Librespot@LibreELEC. But actually it did not.

    Then the device (Librespot@LibreELEC) disappeared from the overview of connect devices in android spotify app.

    Hope this helps to narrow it down somehow.

    • Official Post

    Nice approach!

    here you are (errors indeed):

    During this my Android app showed that track is playing on Librespot@LibreELEC. But actually it did not.

    Then the device (Librespot@LibreELEC) disappeared from the overview of connect devices in android spotify app.

    Hope this helps to narrow it down somehow.

    Got it!

    ffmpegx for RPi2 is built with mmal support, which is apparently lacking on Odroid_C2/arm. I am sure Raybuntu will build the addon, if you ask him to.

  • Is this mmal thing something raspberry specific? How does your addon work then on aarch64 systems like the official 64bit C2 builds? Is mmal mandatory for it, also in the future?

    Good that we know the issue now :)

    • Official Post

    Is this mmal thing something raspberry specific? How does your addon work then on aarch64 systems like the official 64bit C2 builds? Is mmal mandatory for it, also in the future?

    Good that we know the issue now :)

    ffmpegx (which streams librespot output to RTP) uses project specific hardware acceleration support, such as mmal. Using ffmpegx built for a project (RPi2/arm) on another project (Odroid_C2/arm) might therefore not work.

    I will see if I can add features required by librespot (native PCM transcoding and RTP) to ffmpeg provided by LibreELEC, but that will be for LibreELEC 9.0.

    In the meantime, a solution is to build the addon (or ffmpegx) for Odroid_C2/arm.

  • I will have to refresh my addons repo for LE8. I'm unable to test Spotify. I'm currently focusing on LE9. Are those new features merged at LE already? If it was merged lately I might not had the chance to pull and build it yet.

    My Addons are built natively for the platform, so infinity85 should use my rb-leia builds for C2 and install those Addons from my repo. But please report all issue to me.

    Mixing RPi addons with C2 will not work in this case cause it's linked against libmmal which is not used by C2 nor necessary to build.

    • Official Post

    I will have to refresh my addons repo for LE8. I'm unable to test Spotify. I'm currently focusing on LE9. Are those new features merged at LE already? If it was merged lately I might not had the chance to pull and build it yet.

    My Addons are built natively for the platform, so infinity85 should use my rb-leia builds for C2 and install those Addons from my repo. But please report all issue to me.

    Mixing RPi addons with C2 will not work in this case cause it's linked against libmmal which is not used by C2 nor necessary to build.

    Those new features have been merged into LE 8.0, 8.2 and 9.0.

  • Since GDPR-1 released a new LE build, the kodi-output option finally started working :)

    Now I see what the aim was, to include this function:

    • Ability to control Spotify through KODI Interface
    • This was unclear for me and that's why I asked twice why you included this function (didn't know your itention)

    However there are some issues I'd like to mention and to get explained, if possible:

    1. (Using KODI output instead of ALSA:) After choosing Librespot@LibreELEC in my Android Spotify app the connection seems to have trouble getting established. It is mostly done successfully after the second attempt.
    2. The librespot service seems to crash after one track and Librespot@LibreELEC device disappears as an available spotify device in Smartphone App. I need to do librespot.start to get it appear again. Here's the log then:
       

      And a second attempt:

      Code
      LibreELEC:~ # librespot.start
      INFO:librespot: librespot ebeb776 (2017-07-08). Built on 2017-07-08.
      *** WARNING *** The program 'librespot' uses the Apple Bonjour compatibility layer of Avahi.
      *** WARNING *** Please fix your application to use the native API of Avahi!
      *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=librespot>
      INFO:librespot::session: Connecting to AP "gew1-accesspoint-b-dz71.ap.spotify.com:4070"
      INFO:librespot::session: Authenticated as "wmissal" !
      INFO:librespot::session: Country: "DE"
      thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: WireError("invalid value for enum: 12")', /checkout/src/libcore/result.rs:859
      note: Run with `RUST_BACKTRACE=1` for a backtrace.

      Two different issues here, apparently. And after that it dissappears again as available device in the smartphone app. Need to restart Kodi.

    3. Independently from the other issues: Once the connection works the song starts playing after ca. 5s on Kodi and plays for about 3s. Then the sound disappears, the timestamps seem to jump betweet 4 and 5 seconds up and down (like a hickup without audio)... this takes about 5 seconds and then the song proceeds to play. Observed this many times.
      Thats the log for this:

      "stream stalled"

    4. In kodi the showed playtime does not display the correct values. It is simply proceeding and doesn't start counting from 0 after the next song starts playing. It is always showing proceeding times like this: 06:48/06:56 with a delta of 8s between both times.

    5. Similar: In kodi I see how librespot is showing the now playing info: "Librespot 00:xx / 00:xx minutes", but I cannot find it in Music section of Kodi? How do I access the controls/playlist in Kodi then?
    6. Also playing a continuing playlist does not work apparently. After one song is finished it jumped only once to the next, and after that one playback stopped and crashed apparently (as the librespot@libreleec device disappeard again). Mostly it does not even play the second song.
    7. Controls through smartphone (play/pause/skip etc.) seems to be without any effect? Perhaps supposed to be this way?

    That's a load of issues, so I guess it is platform specific here, isn't it?

    • Official Post

    Spotify changed its API and broke librespot yesterday morning, librespot was fixed yesterday evening, and the addon was updated just after that. Raybuntu should update the addon he provides.

    As for Librespot through Kodi behaviour:

    - Kodi user has priority over Spotify user (Librespot is not active when Kodi user is playing back a media, Kodi user can stop Librespot streaming, etc.)

    - Librespot is controled via a Spotify app (start, stop, pause, etc.)

    - Librespot streams to Kodi via ffmpegx/RTP, which introduces latency.

  • Okay, I'm still a bit confused, sorry for that...

    What is "spotify user" in your view?

    So far I understood:

    1. Librespot is the spotify connect reverse engineered api, so it is basically spotify connect (api), which streams directly from the internet, but is controlled via the smartphone app
    2. Even in Kodi-mode Librespot is controled via a [smartphone] Spotify app , which means it is like a chain consistenf of:
      • Smartphone app controls librespot on the RPi/C2
        • This controlled playback is then handed over as a stream to Kodi via ffmpegx/RTP, which introduces latency.
          • So basically it is still spotify connect, but simply with latencies and the benefit is that kodi knows and shows the playback
    3. Librespot receives the internet-audio-stream and hands it over as audio stream to kodi (in kodi output mode). So that means this Librespot streams to Kodi via ffmpegx/RTP is done locally on the LibreELEC RPi/Odroid, right? Currently there is not just latency, but it crashes almost always, but thats apparently another story.

    If my point 2.) is understood corretly by me. Then the unsuccessful control via smartphone app was caused by the changed api, or is this something that is still WIP? It is actually supposed to be controlled through, smartphone app, if issues are resolved, right?

    And where do I find in kodi the currently played playlist? Is the playlist not present because the audio is simply streamed to kodi from librespot via via ffmpegx/RTP without further infos (e.g. playlist info and track info) as a pure audio-stream?

    Thanks for your patience and the time you took to explain it ;)

  • Hey I just upgraded really easy from openelec to LibreElec 8.0.2 on Linux

    I did this to get Librespot (8.1.102). That add-on works great, very impressive

    After a reboot of linux I do see librespot as a running add-on

    But my phone doesn't see it..

    I go to librespot > configure > ok (left everything as it was)

    And now my phone does see librespot

    How do I get this to work when I boot into Kodi ?

    Edit

    Solution here

    Edited once, last by Camella (July 10, 2017 at 8:36 PM).

  • Hey,

    maybe I should note here that even the older 100a version (2 weeks ago?) works with an ODROID C2 (32bit raybuntu krypton13 or 14).

    However it doesn't work reliable. Sometimes it does, sometimes not. If not, I restarted the device, which increases the chance of success. But if it works, it works great. Like a car: if it rolls, it rolls ;)

    I will test your new version tomorrow to give you newer feedback if needed!

    • Official Post

    Here is a new preview release that attempts to solve two issues:

    - latency in streaming to Kodi

    - audio device not ready on service startup ( Camella)

    On RPi2 latency is significantly improved

    I have no hardware to test that audio device is ready before librespot service starts.

    Thank you for you feedback.

    Code

    Preview for Generic

    Preview for RPi2 (should also run on Odroid_C2/arm)