Plan - Premium
Country - Cyprus
Device - Macbook Pro
Client - Chrome
Hi Spotify Team,
I'm working on a project that involves Spotify Web API and Spotify IFrame API.
Project components are:
1. Web browser client with IFrame API Embed Controller
2. Application backend REST API that makes calls to Spotify Web API
The typical use case is:
1. The web browser client sends request to the application backend REST API in order to create playlist or update it with recommendations
2. Application backend sends a Spotify Web API request to create a playlist and update it with recommendations or to update existing playlist
3. Application backend receives a response from Spotify Web API with a new version of the playlist and sends it to the client
4. Web browser receives playlist resource from application backend and uses EmbedController.loadUri in order to load the playlist in Embed
Since all components of the project operate in the same location (Cyprus), everything is working well.
Recently the backend was deployed in the cloud, located in Stockholm.
The client and application backend are in different locations now, and calls to the Spotify Web API are performed from Stockholm.
Meantime Web browser client is in Cyprus.
I've noticed that in this configuration sometimes EmbedController.loadUri may load a previous version of the playlist.
Though Spotify Web API provides the application backend with the new snapshot and playlist content such as tracks and only after this happens the backend sends playlist resource to the web browser client.
It is important to say, that if EmbedController will wait approximately 5 seconds after the changes applied to Spotify Web API and make an attempt to load URI, it will work fine.
Example:
Preconditions: Spotify Playlist A with tracks a,b exists, snapshot id=1. In the web browser EmbedController created, embed shows the existing Playlist A
1. The web browser client sends a request to the application backend in order to update the existing Playlist A with new tracks
2. Application backend calls Spotify Web API method Add Tracks c,d to the existing Playlist A
3. Application backend receives a response that contains a new version of Playlist A with tracks a,b,c,d and snapshot id=2
4. Application backend sends a new version of the Playlist A to the web browser client
5. The web browser client receives a new version of the Playlist A and uses EmbedController.loadUri to update the playlist in the embed on the page.
Expected result: embed updated and shows Playlist A with tracks a,b,c,d
Actual result: embed updated and shows Playlist A with tracks a,b
Is there any method in IFrame API or Spotify Web API that can be used in order to explicitly call a new version of playlist to be loaded in the web browser's page Spotify Embed?
Thank you.