I've used this script to make it possible to turn on and off my audio. However, as I don't have an option to click and loop my song on my timeline. When this song ends, it doesn't play again.
I would like to know if I can add something to this script to make my song loop after it ends.
I've found this and have tried ...
createjs.Sound.play("soundId", {loop:-1});
But it doesn't work!
I'm working on html5 canvas on Adobe Animate!
I'm using this script, it works:
createjs.Sound.on("fileload", function handleLoad(event) {
root.audio = createjs.Sound.play("soundID");
});
createjs.Sound.registerSound("sounds/myaudio.mp3", "soundID");
//this.audio1.paused = true; // pause
//this.audio1.paused = false; // resume
this.onOff_btn.on("click", function(){
if(root.audio.paused) {
root.audio.paused = false; // resume
} else {
root.audio.paused = true; // pause
}
});
Thank you in advance!