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.