mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 14:40:38 +00:00
Handling delayed playback in update method
This commit is contained in:
parent
3388fd018f
commit
fb6b989035
1 changed files with 10 additions and 1 deletions
|
@ -126,7 +126,16 @@ var HTML5AudioSound = new Class({
|
|||
BaseSound.prototype.stop.call(this);
|
||||
},
|
||||
update: function (time, delta) {
|
||||
|
||||
if (this.isPlaying) {
|
||||
// handling delayed playback
|
||||
if (this.startTime > 0) {
|
||||
if (this.startTime < time) {
|
||||
this.audio.currentTime += (time - this.startTime) / 1000;
|
||||
this.startTime = 0;
|
||||
this.audio.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
destroy: function () {
|
||||
BaseSound.prototype.destroy.call(this);
|
||||
|
|
Loading…
Reference in a new issue