Added method for finding unused audio tag for playing sound

This commit is contained in:
Pavle Goloskokovic 2018-01-11 18:04:17 +01:00
parent 6730b3b314
commit 935ef78102

View file

@ -64,6 +64,19 @@ var HTML5AudioSound = new Class({
this.events.dispatch(new SoundEvent(this, 'SOUND_STOP'));
return true;
},
pickAudioTag: function () {
if (!this.audio) {
for (var i = 0; i < this.tags.length; i++) {
var audio = this.tags[i];
if (audio.dataset.used === 'false') {
audio.dataset.used = 'true';
this.audio = audio;
return true;
}
}
}
return true;
},
update: function (time, delta) {
},