刚刚从 irc 的开发团队直接确认它是一个Spotify 客户端错误。这是一个修复+其他糖果之类的通用事件界面。
https://gist.github.com/bc1a7e1c06c1077f238d(发射器来自组件仓库https://github.com/component/emitter)
使用我的补丁,我们可以做这样的事情:
var sp = getSpotifyApi(1)
var models = sp.require('sp://import/scripts/api/models')
var player = sp.require('player-fix').player
window.onload = function init() {
console.log('subscribing')
player.on('play', function () {
console.log('play')
}).on('pause', function () {
console.log('pause')
}).on('trackChange', function (track) {
console.log('trackChange', track.data.name)
}).on('shuffleChange', function (shuffle) {
console.log('shuffleChange', shuffle)
}).on('repeatChange', function (repeat) {
console.log('repeatChange', repeat)
}).on('volumeChange', function (volume) {
console.log('volumeChange', volume)
}).on('contextChange', function () {
console.log('contextChange')
})
}