spotify-player icon indicating copy to clipboard operation
spotify-player copied to clipboard

Failing to start playing with a large number of tracks

Open mariabug opened this issue 2 years ago • 3 comments

Hi, I have been having an small issue with spotify-player. For some reason when I hit play in my liked tracks nothing plays at all. However if I was already playing the liked tracks playlist in some other device, like my phone, and then just change to spotify-player, the playlist continue without any hitch, which is the roundabout I have been using.

Here is the log:

spotify-player-22-09-06-11:51.log

mariabug avatar Sep 06 '22 18:09 mariabug

Hi @mariabug. Thanks for reporting. Judging from the log, it seems like the app couldn't start a playback [1] with too many tracks:

...
TrackId("4V5PtBjMHOZBpXR3Po3Hiv")], Some(Uri("spotify:track:55McbqAUspPoavubDJxryF")))))}: 
spotify_player::client::handlers: 
Failed to handle client request: http error: status code 413 Payload Too Large

I'm not so sure how the official app handles this, maybe it uses an internal API different from what's exposed to the public. I'll think about implementing a hack to handle this case.

[1]: https://developer.spotify.com/documentation/web-api/reference/#/operations/start-a-users-playback

aome510 avatar Sep 07 '22 16:09 aome510

Hey, just wanna say I'm experiencing the same thing.

If you really wanna listen to your liked songs, I've found a way to do it.

  1. Start playing a random song on the terminal
  2. Open Spotify on your phone
  3. Use your phone as a controller for the session running in the terminal
  4. Navigate to you liked songs on the phone and start playing them!

Trying to see the songs context won't work tho

Rinkerbel avatar Sep 17 '22 17:09 Rinkerbel

If you really wanna listen to your liked songs, I've found a way to do it.

  1. Start playing a random song on the terminal
  2. Open Spotify on your phone
  3. Use your phone as a controller for the session running in the terminal
  4. Navigate to you liked songs on the phone and start playing them!

Yeah, currently it's the only workaround to start liked song playback (with a large number of songs).

Trying to see the songs context won't work tho

Official Spotify client seems to implement a custom playback context for liked songs. So using the get_context API to show the playing context won't work. This is similar to their queue playback context, e.g no public API to access.

One way to resolve this issue is actually implementing a custom context like Spotify did. However, it will be quite complicated, and I don't have much time to support that now. Contributions are welcome though 💪

In the meantime, hope that the above workaround is good enough

aome510 avatar Sep 17 '22 18:09 aome510

I am also dealing with this issue.

Is there no way to limit the number of track ids to the tracks that are visible in the ui or something similar? perhaps just limit track ids to a number with each scroll?

alexseitsinger avatar Oct 22 '22 15:10 alexseitsinger

@alexseitsinger @mariabug @Rinkerbel, sorry for the delay. This issue should be fixed in https://github.com/aome510/spotify-player/releases/tag/v0.10.0. Feel free to reopen this issue if encounter any related issues.

I implemented the fix by restricting the number of tracks playing, e.g only play 200 tracks surround the selected track when starting a new playback.

aome510 avatar Dec 26 '22 03:12 aome510