问题
Can I listen for events, like a song ending, with the Spotify API?
If so, how?
Thanks!
回答1:
Yes.
Add an observer for models.EVENT.CHANGE on the player object. When this fires, check that playing is false. The song has ended if the position of the player object is the length of the playing track, or if the playing track is null.
来源:https://stackoverflow.com/questions/9328890/can-i-listen-for-events-like-a-song-ending-with-the-spotify-api