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:
Pavle Goloskokovic 2018-01-12 15:39:58 +01:00
parent 1ec66f644f
commit a51a0bd543

View file

@ -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 () {