Sorting sounds to hijack audio from by loop and seek properties values

This commit is contained in:
Pavle Goloskokovic 2018-01-11 18:12:52 +01:00
parent f377b4fa85
commit 106e32499f

View file

@ -83,6 +83,12 @@ var HTML5AudioSound = new Class({
otherSounds_1.push(sound);
}
});
otherSounds_1.sort(function (a1, a2) {
if (a1.loop === a2.loop) {
return a2.seek - a1.seek;
}
return a1.loop ? 1 : -1;
});
var selectedSound = otherSounds_1[0];
this.audio = selectedSound.audio;
}