spotify / web-api

This issue tracker is no longer used. Join us in the Spotify for Developers forum for support with the Spotify Web API ➡️ https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
981 stars 79 forks source link

Web Playback Status Updates in Real Time #1330

Open mohammedjammeh opened 5 years ago

mohammedjammeh commented 5 years ago

I am currently working on a web application which heavily relies on the Spotify API. Everything is working fine as expected. However, I got stuck on a minor Playback issue.

I've managed to integrate the Web Playback SDK into the application and I can get real time updates based on the status of the Playback. On the other hand, I've noticed if a user is controlling the Playback with the another Spotify Player (e.g. the desktop or mobile player), I can't seem to access the Player status updates for this.

My plan was to send a request to the API every second or so to get information about the user's current playback but this might not be sustainable due to rate limits and the amount of users who might be sending the requests.

As I was reading online, I came across this discussion which started two years ago and it seems a lot of people are requesting a Web Socket solution like how it works for the local Spotify Connect Player. I was just going to drop commend on that issue but the ticket is closed and I was wondering what the status is on this. If Spotify is not able to make these changes, what other solutions would you recommend? Thank you.

Coding-Kiwi commented 5 years ago

As you might already have read in the linked discussion, spotify doesn't want to add websockets. The exact reasons are unclear, maybe they are scared that other people would build a better client than theirs or their servers would get polled less.. I don't know, they for sure have reasons.

To answer your question: It seems the only options you have are a) spam-polling the GET /player endpoint like spotify apparently wants us to do b) try to get a business deal with spotify for a so called "partner integration", like discord for example

mohammedjammeh commented 5 years ago

I know, it's annoying. It would've been really nice to be able to get status updates of other playbacks e.g. devices like Sonos, etc.

I think they are not implementing this as it might be difficult to integrate it now as the neither the Connect functionality nor the Web Playback has been built taking this into consideration.

Without a doubt, it is possible and hopefully, they will get back to us on this. It will be really cool to see this working as so many people are requesting for it.

mohammedjammeh commented 5 years ago

@hughrawlinson @arirawr Any updates or solutions on this? It would nice if we can get Playback Statuses in real time. If not, due to business reasons, then that's fine. Either way, thanks for the service and overall the API is great.

arirawr commented 5 years ago

@mohammedjammeh I'm no longer at Spotify and don't have any info about this. The issue you linked is still the place to watch for updates.