From 99aa2b22c4ed0aa2670de89d763288a8a886e347 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Tue, 5 Dec 2017 20:22:49 +0100 Subject: [PATCH] Resetting sound playback at seek time if sound is playing --- v3/src/sound/webaudio/WebAudioSound.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/v3/src/sound/webaudio/WebAudioSound.js b/v3/src/sound/webaudio/WebAudioSound.js index e6cfe8a95..2338d0a03 100644 --- a/v3/src/sound/webaudio/WebAudioSound.js +++ b/v3/src/sound/webaudio/WebAudioSound.js @@ -262,6 +262,10 @@ Object.defineProperty(WebAudioSound.prototype, 'seek', { set: function (value) { value = Math.min(Math.max(0, value), this.duration); this.currentConfig.seek = value; + if (this.isPlaying) { + this.stopAndRemoveBufferSource(); + this.createAndStartBufferSource(); + } } }); module.exports = WebAudioSound;