It triggers twice all the time with different values…
This is my code:
window.onload = function init() {
console.log('subscribing')
player.observe(models.EVENT.CHANGE, function (e) {
console.log('e.data.curtrack %d', e.data.curtrack)
console.log('e.data.playstate %d', e.data.playstate)
console.log('---')
console.log(player.playing)
})
}
Just confirmed it to be a Spotify client bug directly from the dev team on irc.
This is a fix + other candies like a common event interface.
https://gist.github.com/bc1a7e1c06c1077f238d (Emitter comes from the component repo https://github.com/component/emitter)
Using my patch we can do something like this: