0
votes

I'm developing a web application that utilizes the Spotify Widgets. You put songs into a playlist, press play and it plays through the Spotify desktop client. That works fine. Next I'd like to be able to add or delete songs from the playlist while it is playing. I'm using AJAX to do this, and the web application reflects the changes, and the iframe shows the correct change. However, the desktop client doesn't show the change, and it continues playing the old playlist. I can get the desktop client to show the change by pressing next/back in the iframe, or by pausing, refreshing the page, and pressing play. Does anyone know a way to update the desktop client with javascript?

Rephrased: Here's the code I'm using to generate a playlist

<iframe src="https://embed.spotify.com/?uri=spotify:trackset:PREFEREDTITLE:<%=@trackplaylist%>" frameborder="0" allowtransparency="true"></iframe>

where @trackplaylist is a list of track_ids separated by commas. When you hit play it starts playing the playlist on the desktop client (like its supposed to).

The problem arises when @trackplaylist changes while its playing. When the page is reloaded, the widget shows that the music is still playing, and examining the source shows that the widget reflects the new tracklist, however the desktop client still shows the old tracklist, and continues to play the old one.

I can solve this problem by pressing next on the widget, but I was wondering if there was a way to do this without requiring user action.

1
I'd really appreciate if you could elaborate more on what you're trying to do. From my understanding, you're using the Spotify Play Button to render playlists. What I'm not understanding is to which API your sending your XHR? Are you writing a Spotify App as well? - Michael Thelin
I've rephrased the question and I hope this time it is more clear. I am not writing a Spotify App, I'm only using the Spotify Widgets. Thank you for taking the time to look into this! - Dylan Shields

1 Answers

0
votes

Thanks for rephrasing your question.

We don't currently support dynamic changes of tracksets. Given the penalisation and low performance it would mean having to destroy and insert a new iframe, combined with the time that it takes to detect the Desktop Client once the iframe is rendered again, we don't recommend it.