mirror of
https://github.com/aome510/spotify-player.git
synced 2026-04-26 09:25:49 +03:00
[GH-ISSUE #603] Player got stuck in one song #1286
Labels
No labels
bug
documentation
enhancement
good first issue
help wanted
pull-request
question
third-party
third-party
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-player#1286
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @xd-mau5 on GitHub (Nov 6, 2024).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/603
Describe the bug
After using spotify-player for like 15 minutes listening a playlist the player gets stuck on a song, even if you select previous or next, it stays on the same song, if you try to place another song by selecting it directly, it does not play the one you have chosen.
To Reproduce
Expected behaviour
continue playing without issues
Log and backtrace
spotify-player-24-11-06-11-21.log
Screenshots
Video
Environment
@dhgwilliam commented on GitHub (Nov 19, 2024):
been happening to me to, i'm working on trying to predict it. one possibility on my mind is that when unpausing a song after a long idle, the player loses the context of the playlist? but i'm not 100% on that. the rest of the issue described above is the same for me, although i'm on a mac
@avastmick commented on GitHub (Jan 6, 2025):
I get the same on MacOs - M2 MBP. Installed via
cargo install spotify_player --features image.After about 10 tracks it hangs on one track. If another is selected and played, it does so silently. Only a restart will recover.
Looking at the logs I get a failure on starting a new track until it loops through the playlist to get to the track it was playing previously and can play and starts again:
@avastmick commented on GitHub (Jan 6, 2025):
Update. I am looking at the logs (as per my earlier comment) and thinking about the issue. I have now tried the following:
Not ideal, but I can now play for longer than ~30 minutes. It seems as if it is an authorization error. It used to work fine, so maybe it's an upstream issue with
librespot?@alexjyong commented on GitHub (Jan 24, 2025):
I wonder if a temporary fix would be reloading the start up of the application or the authorization or whatever restarting the application does to "fix" it when the error is detected (which seems to be from librespot)
@alexjyong commented on GitHub (Jan 24, 2025):
I wonder if this is related to here: https://github.com/librespot-org/librespot/issues/1101
@alexjyong commented on GitHub (Jan 29, 2025):
Got some logs to help out.
It got to this song, and just started playing it on repeat.
Looks like something is busted with librespot.
spotify_player version
0.20.4MacOS Sequoia 15.2
And after a ton of those logs, eventually loads the last song played
And just keeps doing that over and over.
@alexjyong commented on GitHub (Jan 29, 2025):
Also when the bug happens, I noticed this:
Hitting next track button or whatever just plays the same song over and over.
Selecting a new playlist and starting that will cause the player to show it "playing" but it's silent.
Logs from that are:
Only restarting the player completely fixes this.
@cmorgannorris commented on GitHub (Feb 6, 2025):
Same thing is happening to me. Restart fixes it for me, but it happens again pretty soon thereafter.
@alexjyong commented on GitHub (Feb 6, 2025):
Yeah barring a proper fix either on
spotify-playerorlibrespotmy vote for a temp fix would be having the application detecting when it's in a loop like this and restarting itself (but saving what playlist, song, etc) it's in to seamlessly recover itself.I remember seeing somewhere in the code getting a new token with certain errors. No idea off hand how that's triggered. I am curious as to how it's able to recover fully with a restart.
@cmorgannorris what do the logs say on your end?
@cmorgannorris commented on GitHub (Feb 7, 2025):
Here are a few lines from where it starts throwing errors, to where it gets caught in a loop of access token expired. It goes on for thousands of lines.
@alexjyong commented on GitHub (Feb 7, 2025):
Running the
RestartIntegratedClientcommand helps get the player unstuck; although you have to go back into the playlist, queue or whatever you were playing.@cmorgannorris commented on GitHub (Feb 11, 2025):
Here are some more logs. I made a note to look right after it got stuck this time. At the top you can see a successful transition from Need You Tonight to Meditate but then it's stuck. It repeats the BAD_REQUEST error and attempts to skip track repeatedly in a just a matter of seconds; I didn't include all of the repeats.
Then at some point it finally gets a new token. I believe I restarted the integrated client, but I can't remember; I was in a hurry to get to the logs and see what was up.
Not sure if any of this helps. It's all probably just more of the same but I figured I'd dump it here just so we have the data.
@alexjyong commented on GitHub (Feb 11, 2025):
I am getting a lot of theses in my logs now
I did notice in the logs the original token's expiration was around the same time the songs started looping.
I'm guessing when tokens expire, we aren't handling getting new tokens properly or something? I need to test more.
@alexjyong commented on GitHub (Feb 12, 2025):
Just saw this again now
That timestamp converts to
2025-02-12 11:47:34 AM ESTwhich is right around where the songs started looping.Expiry time matches with logs where error starts happening.
My hypothesis is that the tokens expire and we aren't refreshing for a new one.
Looks like we have code to handle this? Wonder what's going on with it not catching this or whatever.
github.com/aome510/spotify-player@78edb10e15/spotify_player/src/client/spotify.rs (L74-L89)@alexjyong commented on GitHub (Feb 12, 2025):
More logs. Looks like we do refresh the token but we do it multiple times.
Either way later, it still doesn't work and we get INVALID_CREDENTIALS
Wonder if the old token is still in play?
Either way, what has been consistent is that after an hour (the token's lifespan) the songs start repeating, and I have to restart the application or RestartIntegratedPlayer
@alexjyong commented on GitHub (Mar 3, 2025):
So I made a PR (against my local branch) that sometimes works, but other times, runs into the same issue.
https://github.com/alexjyong/spotify-player/pull/1
Logs
One side effect is when the token expires (which happens on the code at the time of writing) is the list of playable items fading away, although navigating to another page, or back to the page you are on fixes it. Would be nice if that could be automated, but this is all new to me.
@alexjyong commented on GitHub (Mar 3, 2025):
Update, while my changes appear to be more stable that whats in master at present, eventually, we run into an error where the song will play silently. You can navigate between different pages, load up different lists, and logs show that we are getting a new token and loading it as expected.
But eventually we end up with
@alexjyong commented on GitHub (Mar 4, 2025):
I went and made a PR against upstream master with what I have so far. At this point, I figure it's better than nothing, as it does partially fix it. The bug still comes back here and there, but not always.