librespot-org / librespot-java

The most up-to-date open source Spotify client
Apache License 2.0
375 stars 91 forks source link

Playing an album track doesn't look like its playing in Spotify apps #832

Open christosk92 opened 7 months ago

christosk92 commented 7 months ago

I've attached a picture at the bottom of this post indicating the problem.

It seems that the context-resolve endpoint (context-resolve/v1/uri) sometimes returns the UID of a track. It does not seem to return the uid for album tracks: image Therefeore the PlayerState's track_uid is empty, which I think the clients use to find which track is playing.

If we play the track using the official clients (desktop and web), uid is filled image

But I have no idea where to find this UID. The only place I seem to be able to find it is if we do an album resolve (GraphQL endpoint). But the desktop app seems to also know this ID without doing such call (transfering state). So it's making me believe this could be a computed property.

Does anyone know how ? Is there even a relationship between the base62 id (spotify:track:2XkDm5m2vPowecEAAR5gmb) and this seeminly base16 id? (67d43c187351cea560aa)

image

devgianlu commented 7 months ago

I have always wondered whether the UID can be figured out in some way. So far I have ignored it.

christosk92 commented 7 months ago

The UID of a track is the same in the following scenarios: 1) Track in user's saved songs 2) Track in an album 3) Track in a user playlist IF the track only appears once

For 3. If the track appears more than once, or the playlist is spotify generated, the UID seems to be very random. But playlists isnt' really a problem because they are returned with the context-resolve endpoint.

I will try and do more research...