From d6256c47c51b82ce471a14df7ab9350ed04964ef Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Thu, 11 Jan 2018 18:23:28 +0100 Subject: [PATCH] Defined startTime property --- src/sound/html5/HTML5AudioSound.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/sound/html5/HTML5AudioSound.js b/src/sound/html5/HTML5AudioSound.js index 966eb0ff4..e5dcfbaec 100644 --- a/src/sound/html5/HTML5AudioSound.js +++ b/src/sound/html5/HTML5AudioSound.js @@ -26,6 +26,16 @@ var HTML5AudioSound = new Class({ * @default 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.totalDuration = this.tags[0].duration; BaseSound.call(this, manager, key, config); @@ -192,8 +202,7 @@ Object.defineProperty(HTML5AudioSound.prototype, 'seek', { if (this.isPlaying || this.isPaused) { value = Math.min(Math.max(0, value), this.duration); if (this.isPlaying) { - this.previousTime = - this.audio.currentTime = value; + this.audio.currentTime = value; } else if (this.isPaused) { this.currentConfig.seek = value;