检测歌曲的结尾 - SoundJS

时间:2016-12-19 21:52:03

标签: javascript createjs soundjs

我正在使用SoundJS播放音乐。如何检测歌曲何时结束?

SoundJS可以检测事件,歌曲结束时是否有事件?像这样的东西:

var songInstance = createjs.Sound.play("sound");
songInstance.on("_SONG_ENDED_", function(){
     //do something after song has ended
});

1 个答案:

答案 0 :(得分:2)

我认为您可以根据此网站执行以下代码:http://createjs.com/docs/soundjs/classes/Sound.html

instance.on("complete", this.handleComplete, this);