I am trying to as the title reads play buzz.js
sound objects one after another. I have tried using the events - ended
callback but this becomes rigorous with a large set of files. I thought i could create my list of sounds, iterate through them and call the bind one time but that didn't work as the iteration doesn't wait for the call back to finish. I am using node.js.
Here is what i have so far:
var mySound1 = new buzz.sound("/sound/001000.mp3");
var mySound2 = new buzz.sound('/sound/001001.mp3');
var mySound3 = new buzz.sound('/sound/001002.mp3');
for (var i = 0, max = 3; i < max; i++) {
var sPath = '/sound/001' + soundArray[i].value + '.mp3';
var sound1 = new buzz.sound(sPath);
sound1.play().bind('ended', function(e){
//here i want sound1 to finish before sound2 plays and so forth
});
}
How can i wait until sound1 has finished before sound2 starts playing in a dynamic way ?