[HowTo] Spotify-Connect support via Raspotify (LibreSpot)



thank you very much for the article. Raspotify works great! Regarding the limitations: unfortunately, even when I pause Spotify playback before playing a movie on Kodi, the sound doesn’t get switched. Please, is there any workaround for the issue? I don’t mind if the workaround involves running some sh scripts, I just don’t want to reboot the system every time that happens.



Hey Martin,

I made the test on the last stable OSMC/kodi on a Vero 4k and the music stops when I start to play a movie.


Why pause? First post says to stop.

It may work without stopping but in my case it didn’t. So I always stop the music first.


Hi I have Spotify Premium and am running OSMC on a Raspberry Pi 2. I have gone through the Automatic Setup process at the top of this thread and the installation finished successfully. I then went into the config file and updated the Device name and put in my Spotify username and pwd details.

I am able to see OSMC as a device to connect to using Spotify Connect. I am also able to connect to OSMC, I am able to start music playing, but after 20-30 seconds it stops and doesn’t come back. I logged into OSMC by SSH and checked the status of Raspotify and it gave me the following:

Feb 25 14:51:47 OSMC librespot[582]: INFO:librespot_playback::player: Loading track "Outlander - The Skye Boat Song (After Culloden)"
Feb 25 14:51:57 OSMC librespot[582]: INFO:librespot_playback::player: Track “Outlander - The Skye Boat Song (After Culloden)” loaded
Feb 25 14:52:03 OSMC librespot[582]: ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred

Has anyone experienced this issue and does anyone know how to fix it?
Thanks in advance :slight_smile:


So after doing some investigating my attention was drawn to this line in the config.

To choose a different output device (ie a USB audio dongle or HDMI audio out),
use --device with something like --device hw:0,1. Your mileage may vary.

Investigating the different device options, I believe that hw:0,1 indicates that you want the audio to be output over HDMI… On a whim I tried setting this in my config for raspotify like so and restarted the raspotify service:

OPTIONS="–username xxxx --password xxxx --device hw:0,1"

Voila! It has been working without issue now for around an hour!! What I don’t understand is why I needed to set this… My understanding is that the default is to output audio over HDMI.


I believe the “device” field was added to Raspotify/LibreSpot recently, I still use an older version.

I will update the Autosetup.sh script to add that to the config.

Btw if you use automatic installer, you can simply enter your credentials and device name in the script and it will add those to Raspotify config. The whole idea is you don’t need to mess around after installing :slight_smile:


Thanks @zilexa that makes sense. So it is a required field in the latest version of Raspotify/LibreSpot.

One other question that I was wondering if you could help me with, I must have missed it but where in the automatic installer script do you add Spotify login credentials? I looked and couldn’t find it…

Thanks again :slightly_smiling_face:


you don’t need login credentials :slight_smile:
the autosetup.sh script only has a field for SpotifyDeviceName. I will add the options HDMI/other to the script to support device type.


Thank you @kcassou and @zilexa for your responses.

Please correct me if I’m wrong but there is not such thing as stopping music on Spotify. Only pausing it.

I have no idea if it was that but after upgrading Raspotify from version 0.10.1 to 0.10.4 the behavior is corrected and everything works as supposed to.

Thank you both for your help!