I have a simple JavaScript that loads sounds:
prefix = \'modules/sounds/\'; _sounds = [\'nameOfSound\',\'nameOfSound\',\'nameOfSound\']; for (var sound
There is an 'ended' event that is emitted when the audio has finished playing. Source
this.play = function(trackName) { return new Promise(function(resolve, reject) { var audio = _sounds[trackName].audio; audio.addEventListener('ended', resolve); audio.play(); }); };