我在我的页面上嵌入了一个 soundcloud 播放器,我想听几个事件,尤其是 SC.Widget.Events.LOAD_PROGRESS,但是这个并没有被触发。PLAY_PROGRESS 工作正常。那么为什么 LOAD_PROGRESS 没有被解雇呢?
initSC: function () {
var self = this;
return {
play: function (id) {
var that = this;
if(this.player === null){
var iframeElement = document.querySelector('iframe');
this.player = SC.Widget(iframeElement);
}
if(self.sid === id && this.player !=null){
this.player.play();
}else{
var uri = "http://api.soundcloud.com/tracks/" + id;
this.player.load(uri, { callback: function () {
self.sid= id;
self.provider = "sc";
that.player.play();
that.player.getDuration(function (durationSC) {
self.duration = parseInt(durationSC) /1000;
self.setDuration(App.UTIL.millisecondsToMMss(durationSC));
});
that.player.bind(SC.Widget.Events.PLAY, function () {
self.playerState = PLAYER_STATES.PLAYING;
console.log("sc starts playing");
});
that.player.bind(SC.Widget.Events.PLAY_PROGRESS, function (e) {
//currentPosition: 0
//loadedProgress: 0
//relativePosition: 0
self.setElapsedTime(App.UTIL.millisecondsToMMss(e.currentPosition));
self.setProgress(e.currentPosition/1000);
});
}});
that.player.bind(SC.Widget.Events.LOAD_PROGRESS, function (e) {
log(e);
});
}
},
player: null
}
问候,菲尔