Skip to content

Commit 935ef78

Browse files
Added method for finding unused audio tag for playing sound
1 parent 6730b3b commit 935ef78

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ var HTML5AudioSound = new Class({
6464
this.events.dispatch(new SoundEvent(this, 'SOUND_STOP'));
6565
return true;
6666
},
67+
pickAudioTag: function () {
68+
if (!this.audio) {
69+
for (var i = 0; i < this.tags.length; i++) {
70+
var audio = this.tags[i];
71+
if (audio.dataset.used === 'false') {
72+
audio.dataset.used = 'true';
73+
this.audio = audio;
74+
return true;
75+
}
76+
}
77+
}
78+
return true;
79+
},
6780
update: function (time, delta) {
6881

6982
},

0 commit comments

Comments
 (0)