剛剛確認這是一個的Spotify客戶端錯誤直接從開發團隊irc上獲得。 這是一個修復 +其他糖果如常見事件接口。
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')
})
}