Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Web Playback SDK - How to get mapping from old to new trackId

Web Playback SDK - How to get mapping from old to new trackId

Plan

Premium

Country

Germany

Device

Lenovo Thinkpad, Chrome 114

Operating System

Windows 11

 

My Question or Issue

 

Hey there,

 

We ran into the following issue when using the Web Playback SDK.

When requesting playback with the trackID "0RGl4d2uebT43Usk4KRbMq" the playback starts just fine, but we receive another trackId ("48ON1LS4SjKolzNlNxihSJ") in the "player_state_changed" event.

 

I noticed that both trackIds refer to the same track, so I suppose that Spotify sometimes migrates track data and then the tracks change IDs, and the player thankfully still supports the old IDs when initiating playback.

 

The issue for us is that we rely on the trackId for the loading state of the player in our application, so our player wouldn't stop loading because the requested trackId didn't match the one in the event. I was looking through the "player_state_changed" event for some kind of mapping mentioning the old trackId, but didn't find anything. Furthermore, I checked whether the play requested would provide any such mapping as a response, but realized it only returns a void Promise.

 

My current workaround is to retrieve the trackData from the Web API for the old and new trackId whenever it changes in the "player_state_changed" event, look for the ISRC in the external_ids property and if it's the same for both trackIds, we know it loaded the correct song and can furthermore update the trackId in the DB.

 

I assume that there are many tracks that are affected by this in our users' data, and I'm not sure whether my workaround will always work, because I don't know if the ISRC is always available in the GetTrack response.

 

1. Can someone confirm/disconfirm whether the ISRC is always present in the "external_ids" property of GetTrack?


2. I'm proposing a feature request to the Spotify dev team to provide the mapping from new to requested trackId, either as a response to the play call, or in the "player_state_changed" event.

Thank you! 🙂

Reply
2 Replies

I think this has something to do with Track Relinking.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Interestingly, I did see a linked_from property in the player_state_changed event, but it's value was null. Maybe this is a bug, then?

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random