Skip to content

Commit

Permalink
fix draw wrong position while playing backward seeking (katspaugh#918)
Browse files Browse the repository at this point in the history
* fix draw wrong position while playing backward seeking

* fix spelling mistake
  • Loading branch information
candyan authored and mspae committed Feb 5, 2017
1 parent 3b9249a commit f4235f3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/wavesurfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,17 +335,18 @@ const WaveSurfer = util.extend({}, util.observer, { util }, {
seekTo(progress) {
this.fireEvent('interaction', () => this.seekTo(progress));

const paused = this.backend.isPaused();
// avoid small scrolls while paused seeking
const oldScrollParent = this.params.scrollParent;
if (paused) {
this.params.scrollParent = false;
var paused = this.backend.isPaused();
// avoid draw wrong position while playing backward seeking
if (!paused) {
this.backend.pause();
}
// avoid small scrolls while paused seeking
var oldScrollParent = this.params.scrollParent;
this.params.scrollParent = false;
this.backend.seekTo(progress * this.getDuration());
this.drawer.progress(this.backend.getPlayedPercents());

if (!paused) {
this.backend.pause();
this.backend.play();
}
this.params.scrollParent = oldScrollParent;
Expand Down

0 comments on commit f4235f3

Please sign in to comment.