1
我使用的是SC HTML5播放器,當一個聲音結束時,我加載另一個聲源,但是FINISH事件似乎只對第一首歌曲發聲,我的代碼是如下Soundcloud HTML5 Player:Events.FINISH只發射一次
//Set the source
document.getElementById("sc-widget").src = scPath;
//get the widget reference
var widgetIframe = document.getElementById('sc-widget'),
widget = SC.Widget(widgetIframe);
//set the finish event
widget.bind(SC.Widget.Events.FINISH, endSC);
function endSC() {
var scPath = "http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F1848538&show_artwork=true&auto_play=true";
document.getElementById("sc-widget").src = scPath;
var widgetIframe = document.getElementById('sc-widget'),
widget = SC.Widget(widgetIframe);
widget.bind(SC.Widget.Events.FINISH, endSC);
}
我試過將endSC目標設置爲另一個函數,但那不起作用,我錯過了什麼?謝謝!
截至2012年10月10日,soundcloud api.js的最終結果如下:http://pastebin.com/S13JxRw3 – Autonomy