[GH-ISSUE #336] Not playing/hangs on next song #221

Closed
opened 2026-02-27 19:29:29 +03:00 by kerem · 8 comments
Owner

Originally created by @peterdk on GitHub (May 23, 2019).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/336

In one of my playlists I keep hitting the issue that the last 3 songs of my playlist fail to play. On Spotify OSX I have selected Librespot running on my RPi. When it reaches the song in the interface before the failing ones it just doesn't go to the next and keeps hanging on the last one. When I select the next song it starts 'playing', but Librespot doesn't log the new song and though the progressbar moves in Spotify, there is no audio.
I also tried running Librespot with --verbose, but nothing is outputted.

Is this due to CDN for example? Can I get more debug output out of Librespot?

I am using Raspotify compiled with the current master of Librespot.

Originally created by @peterdk on GitHub (May 23, 2019). Original GitHub issue: https://github.com/librespot-org/librespot/issues/336 In one of my playlists I keep hitting the issue that the last 3 songs of my playlist fail to play. On Spotify OSX I have selected Librespot running on my RPi. When it reaches the song in the interface before the failing ones it just doesn't go to the next and keeps hanging on the last one. When I select the next song it starts 'playing', but Librespot doesn't log the new song and though the progressbar moves in Spotify, there is no audio. I also tried running Librespot with --verbose, but nothing is outputted. Is this due to CDN for example? Can I get more debug output out of Librespot? I am using Raspotify compiled with the current master of Librespot.
kerem closed this issue 2026-02-27 19:29:29 +03:00
Author
Owner

@peterdk commented on GitHub (May 23, 2019):

DEBUG:librespot_audio::fetch: File e78b42a721592a2de8436a6c3b94ea2a78f478f5 complete
DEBUG:librespot_core::session: Session[0] strong=3 weak=4
DEBUG:librespot_core::session: Session[0] strong=3 weak=4
DEBUG:librespot_connect::spirc: At track 11 of 15 <"spotify:user:peterdekr:playlist:7wxwjYJQXDjhtE3kdd1ZmV"> update [true]
DEBUG:librespot_playback::player: command=Load(SpotifyId(u128!(267662077716844162978646694263632685810)), true, 0)
INFO:librespot_playback::player: Loading track "City Gardens" with Spotify URI "spotify:track:67YlhgBxHM8uZAANzSPnc6"
DEBUG:librespot_audio::fetch: Downloading file b48e835716bd7e41dce43c612f0eed109bdf690d
DEBUG:librespot_playback::player: Normalisation Data: NormalisationData { track_gain_db: -3.550003, track_peak: 0.8924745, album_gain_db: -4.459999, album_peak: 0.91598123 }
DEBUG:librespot_playback::player: Applied normalisation factor: 0.66450745
INFO:librespot_playback::player: Track "City Gardens" loaded
DEBUG:librespot_audio::fetch: File b48e835716bd7e41dce43c612f0eed109bdf690d complete
DEBUG:librespot_core::session: Session[0] strong=3 weak=4
DEBUG:librespot_core::session: Session[0] strong=3 weak=4
DEBUG:librespot_core::session: Session[0] strong=3 weak=4

Here it played the first 2 songs ok, and then hangs at the end in Spotify and won't go to the new one. Nothing in the log indicating that something goes wrong.

And when clicking the next song in Spotify, it 'plays' it in the interface, but nothing really happening.

DEBUG:librespot_core::session: Session[0] strong=3 weak=4
DEBUG:librespot_core::session: Session[0] strong=3 weak=4
DEBUG:librespot_core::session: Session[0] strong=3 weak=4
DEBUG:librespot_connect::spirc: kMessageTypeLoad "MacBook Pro" 567f0b561c334617f0a69d423c40d2b9138a2faa 9 1558629335907
DEBUG:librespot_connect::spirc: Frame has 13 tracks

And finally, when stopping Librespot, it hangs and won't respond to CTRL-C.

<!-- gh-comment-id:495295445 --> @peterdk commented on GitHub (May 23, 2019): ```INFO:librespot_playback::player: Track "nyepi" loaded DEBUG:librespot_audio::fetch: File e78b42a721592a2de8436a6c3b94ea2a78f478f5 complete DEBUG:librespot_core::session: Session[0] strong=3 weak=4 DEBUG:librespot_core::session: Session[0] strong=3 weak=4 DEBUG:librespot_connect::spirc: At track 11 of 15 <"spotify:user:peterdekr:playlist:7wxwjYJQXDjhtE3kdd1ZmV"> update [true] DEBUG:librespot_playback::player: command=Load(SpotifyId(u128!(267662077716844162978646694263632685810)), true, 0) INFO:librespot_playback::player: Loading track "City Gardens" with Spotify URI "spotify:track:67YlhgBxHM8uZAANzSPnc6" DEBUG:librespot_audio::fetch: Downloading file b48e835716bd7e41dce43c612f0eed109bdf690d DEBUG:librespot_playback::player: Normalisation Data: NormalisationData { track_gain_db: -3.550003, track_peak: 0.8924745, album_gain_db: -4.459999, album_peak: 0.91598123 } DEBUG:librespot_playback::player: Applied normalisation factor: 0.66450745 INFO:librespot_playback::player: Track "City Gardens" loaded DEBUG:librespot_audio::fetch: File b48e835716bd7e41dce43c612f0eed109bdf690d complete DEBUG:librespot_core::session: Session[0] strong=3 weak=4 DEBUG:librespot_core::session: Session[0] strong=3 weak=4 DEBUG:librespot_core::session: Session[0] strong=3 weak=4 ``` Here it played the first 2 songs ok, and then hangs at the end in Spotify and won't go to the new one. Nothing in the log indicating that something goes wrong. And when clicking the next song in Spotify, it 'plays' it in the interface, but nothing really happening. ``` DEBUG:librespot_core::session: Session[0] strong=3 weak=4 DEBUG:librespot_core::session: Session[0] strong=3 weak=4 DEBUG:librespot_core::session: Session[0] strong=3 weak=4 DEBUG:librespot_connect::spirc: kMessageTypeLoad "MacBook Pro" 567f0b561c334617f0a69d423c40d2b9138a2faa 9 1558629335907 DEBUG:librespot_connect::spirc: Frame has 13 tracks ``` And finally, when stopping Librespot, it hangs and won't respond to CTRL-C.
Author
Owner

@michaelherger commented on GitHub (Jun 4, 2019):

What bitrate are you using? I've got a report of a track which would not play if librespot was told to stream in 320kbps, but the track wasn't available in that bitrate (for whatever reason). What if you run librespot with --bitrate=96? Would it get past your tracks?

The track I was reported was spotify:track:4NYe98w8kYWN2BMhiUIuzq - would this show the same issue as you're seeing?

<!-- gh-comment-id:498515419 --> @michaelherger commented on GitHub (Jun 4, 2019): What bitrate are you using? I've got a report of a track which would not play if librespot was told to stream in 320kbps, but the track wasn't available in that bitrate (for whatever reason). What if you run librespot with `--bitrate=96`? Would it get past your tracks? The track I was reported was `spotify:track:4NYe98w8kYWN2BMhiUIuzq` - would this show the same issue as you're seeing?
Author
Owner

@peterdk commented on GitHub (Jun 5, 2019):

I indeed am using 320kbps. I switched to 96kbps and it actually seems to solve the issue. It now progresses to the next track. Will test a bit more. Unfortunately it's not a solution since I want to keep using 320kbps, but definitely a hint to what is causing it.

<!-- gh-comment-id:499106531 --> @peterdk commented on GitHub (Jun 5, 2019): I indeed am using 320kbps. I switched to 96kbps and it actually seems to solve the issue. It now progresses to the next track. Will test a bit more. Unfortunately it's not a solution since I want to keep using 320kbps, but definitely a hint to what is causing it.
Author
Owner

@peterdk commented on GitHub (Jun 12, 2019):

@michaelherger I added the mentioned track to my playlist, but at 320kbps there seems no issue with that specific track.

<!-- gh-comment-id:501445588 --> @peterdk commented on GitHub (Jun 12, 2019): @michaelherger I added the mentioned track to my playlist, but at 320kbps there seems no issue with that specific track.
Author
Owner

@michaelherger commented on GitHub (Jun 12, 2019):

Correct: the user who reported the issue to me confirmed that it started working again after a few days.

<!-- gh-comment-id:501459571 --> @michaelherger commented on GitHub (Jun 12, 2019): Correct: the user who reported the issue to me confirmed that it started working again after a few days.
Author
Owner

@gddl commented on GitHub (Jul 2, 2019):

I had a similar issue when booting up the (headless) RPi and when skipping songs too fast. The progress bar in the spotify app was moving but librespot just hung. Sometimes it took minutes to load the track and to start playing.
Then I noticed that the kernel ran out of entropy for the /dev/random RNG which is probably used by librespot for Diffie-Hellman key generation (reading from /dev/random blocks until enough entropy is available). I could solve the issue by installing rng-tools and setting up rngd (it uses RPi's HW-RNG to feed the kernel entropy pool).

<!-- gh-comment-id:507837986 --> @gddl commented on GitHub (Jul 2, 2019): I had a similar issue when booting up the (headless) RPi and when skipping songs too fast. The progress bar in the spotify app was moving but librespot just hung. Sometimes it took minutes to load the track and to start playing. Then I noticed that the kernel ran out of entropy for the /dev/random RNG which is probably used by librespot for Diffie-Hellman key generation (reading from /dev/random blocks until enough entropy is available). I could solve the issue by installing _rng-tools_ and setting up _rngd_ (it uses RPi's HW-RNG to feed the kernel entropy pool).
Author
Owner

@willstott101 commented on GitHub (Nov 23, 2019):

I believe this should be properly fixed since https://github.com/librespot-org/librespot/pull/381 as we noticed this issue more consistently with podcasts which often don't have high qualities available.

My solution was: github.com/ashthespy/librespot@ee3a756a6e/playback/src/player.rs (L544)

<!-- gh-comment-id:557825667 --> @willstott101 commented on GitHub (Nov 23, 2019): I believe this should be properly fixed since https://github.com/librespot-org/librespot/pull/381 as we noticed this issue more consistently with podcasts which often don't have high qualities available. My solution was: https://github.com/ashthespy/librespot/blob/ee3a756a6edf8748e90d500430f317c57587e819/playback/src/player.rs#L544
Author
Owner

@peterdk commented on GitHub (Nov 23, 2019):

Great, I compiled and now it runs perfectly on those songs. Thanks for your work!

<!-- gh-comment-id:557828419 --> @peterdk commented on GitHub (Nov 23, 2019): Great, I compiled and now it runs perfectly on those songs. Thanks for your work!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#221
No description provided.