mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Setting previousTime property to currentTime value at the end of update method
Using condition when current time is less then previous time to indicate sound looping and dispatch an event
This commit is contained in:
parent
1ec66f644f
commit
a51a0bd543
1 changed files with 5 additions and 0 deletions
|
@ -188,11 +188,16 @@ var HTML5AudioSound = new Class({
|
|||
this.reset();
|
||||
this.stopAndReleaseAudioTag();
|
||||
this.events.dispatch(new SoundEvent(this, 'SOUND_ENDED'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (currentTime < startTime) {
|
||||
this.audio.currentTime += startTime;
|
||||
}
|
||||
if (currentTime < this.previousTime) {
|
||||
this.events.dispatch(new SoundEvent(this, 'SOUND_LOOP'));
|
||||
}
|
||||
this.previousTime = currentTime;
|
||||
}
|
||||
},
|
||||
destroy: function () {
|
||||
|
|
Loading…
Add table
Reference in a new issue