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! 🙂