Open stippi opened 8 months ago
hi @stippi
i am running into the same problems. have you found any way to fix it?
i am running into the same problems. have you found any way to fix it?
Hi, unfortunately not yet. I added logging to the mentioned callback passed to the player instance for getting an access token. It will fetch a new token on demand, for example when I skip to the next or previous song using the methods provided by the player instance. In this case, playback resumes even after a long time of my page just idling. My plan was to investigate whether the device ID of the player will appear again in the Spotify API that lists devices. If yes, maybe it's an idea to perform some function on the player that causes it to refresh the token in order to repair the connection and "reanable" the device ID for calls to the API.
Thank you for your detailed answer @stippi. It helped me a lot and I think I managed to fix it based on your feedback. I have updated my code and I now request a new token every 5 minutes instead of the 60 minutes spotify suggests. Since the update my player runs smoothly.
I'm happy to hear that. Is your code open source so I could have a look? Thanks!
Hi,
First of all, thanks for making the SDK available and the great documentation and this example!! I was able the get everything working rather quickly. However, a few questions arise which I cannot find answers to anywhere:
When my Single Page Application is open for a longer time, the player connection (usually when idle, i.e. not streaming, but also sometimes when streaming) will become broken eventually. That means, even though I don't receive any "not ready" event from the player, I cannot start streaming again. Some of the symptoms will be (a random combination of them):
Please note that I periodically refresh the access token, and that I give the Player instance a callback implementation that will always use the current access token.
I am perfectly fine with the Player instance becoming stale after a while. What I need is a way to 1) become aware of it reliably (like by receiving the "not ready" event, and 2) being able to recover from that without reloading the page.
I also observed that multiple instances of my application may be registered at the Spotify servers concurrently. For example, when I reload the page, I get a new device ID, and the previous instance may still exist in the Spotify devices list.
Thanks a lot for any clarification!