Saving seek value only when sound is playing or paused, for consistency

This commit is contained in:
Pavle Goloskokovic 2017-12-07 20:58:54 +01:00
parent 8d161ac06d
commit b5e8a60530

View file

@ -266,8 +266,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.isPaused) {
value = Math.min(Math.max(0, value), this.duration);
this.currentConfig.seek = value;
}
if (this.isPlaying) {
this.stopAndRemoveBufferSource();
this.createAndStartBufferSource();