Skip to content

Commit fb6b989

Browse files
Handling delayed playback in update method
1 parent 3388fd0 commit fb6b989

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,16 @@ var HTML5AudioSound = new Class({
126126
BaseSound.prototype.stop.call(this);
127127
},
128128
update: function (time, delta) {
129-
129+
if (this.isPlaying) {
130+
// handling delayed playback
131+
if (this.startTime > 0) {
132+
if (this.startTime < time) {
133+
this.audio.currentTime += (time - this.startTime) / 1000;
134+
this.startTime = 0;
135+
this.audio.play();
136+
}
137+
}
138+
}
130139
},
131140
destroy: function () {
132141
BaseSound.prototype.destroy.call(this);

0 commit comments

Comments
 (0)