From 96498ce8e0ac1fb6908a87e43f9c8a6c88157e76 Mon Sep 17 00:00:00 2001 From: Jer Noble Date: Fri, 28 Mar 2014 09:52:42 -0700 Subject: [PATCH] Fix restarting at current time after pause. --- sound.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound.js b/sound.js index 2303927..c8ee706 100644 --- a/sound.js +++ b/sound.js @@ -216,6 +216,8 @@ Sound.prototype = { this.gainNode.gain.value = this._muted ? 0 : this._volume; this.gainNode.connect(Sound.audioContext.destination); + this.startTime = Sound.audioContext.currentTime; + this.node = Sound.audioContext.createBufferSource(); this.node.connect(this.gainNode); this.node.buffer = this.buffer; @@ -364,7 +366,7 @@ Sound.prototype = { getCurrentTime: function() { if (!this.node) return this.nextStartTime; - return this.nextStartTime + Sound.audioContext.currentTIme - this.startTime; + return this.nextStartTime + Sound.audioContext.currentTime - this.startTime; }, setCurrentTime: function(time) { -- 2.40.1