Reputation: 51403
Can I listen for events, like a song ending, with the Spotify API?
If so, how?
Thanks!
Upvotes: 1
Views: 2383
Reputation: 18776
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
.
Upvotes: 1