我在我的页面上嵌入了一个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
}
此致 菲尔
答案 0 :(得分:0)
这是由一个错误造成的,现在已修复并生效,感谢详细报告。请注意我们支持HTML5音频的范围请求,这意味着我们认为音轨从一开始就被完全加载。
对于不支持本机mp3播放的浏览器,如Firefox,我们将在后台回退到Flash实现,这将触发LOAD_PROGRESS
个事件直到完全加载。