Defined startTime property

This commit is contained in:
Pavle Goloskokovic 2018-01-11 18:23:28 +01:00
parent 82819ec782
commit d6256c47c5

View file

@ -26,6 +26,16 @@ var HTML5AudioSound = new Class({
* @default null * @default null
*/ */
this.audio = null; this.audio = null;
/**
* Timestamp as generated by the Request Animation Frame or SetTimeout
* representing the time at which the delayed sound playback should start.
* Set to 0 if sound playback is not delayed.
*
* @private
* @property {number} startTime
* @default 0
*/
this.startTime = 0;
this.duration = this.tags[0].duration; this.duration = this.tags[0].duration;
this.totalDuration = this.tags[0].duration; this.totalDuration = this.tags[0].duration;
BaseSound.call(this, manager, key, config); BaseSound.call(this, manager, key, config);
@ -192,7 +202,6 @@ Object.defineProperty(HTML5AudioSound.prototype, 'seek', {
if (this.isPlaying || this.isPaused) { if (this.isPlaying || this.isPaused) {
value = Math.min(Math.max(0, value), this.duration); value = Math.min(Math.max(0, value), this.duration);
if (this.isPlaying) { if (this.isPlaying) {
this.previousTime =
this.audio.currentTime = value; this.audio.currentTime = value;
} }
else if (this.isPaused) { else if (this.isPaused) {