Resetting sound playback at seek time if sound is playing

This commit is contained in:
Pavle Goloskokovic 2017-12-05 20:22:49 +01:00
parent 06b7ad91fd
commit 99aa2b22c4

View file

@ -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;