Skip to content

Commit

Permalink
fix: update being called on seekbar during dispose (videojs#6576)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey authored Apr 13, 2020
1 parent 8f930c5 commit 3ac11d0
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/js/control-bar/progress-control/seek-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class SeekBar extends Slider {
}

disableInterval_(e) {
if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e.type !== 'ended') {
if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e && e.type !== 'ended') {
return;
}

Expand Down Expand Up @@ -428,6 +428,26 @@ class SeekBar extends Slider {
super.handleKeyDown(event);
}
}

dispose() {
this.disableInterval_();

this.off(this.player_, ['ended', 'durationchange', 'timeupdate'], this.update);
if (this.player_.liveTracker) {
this.on(this.player_.liveTracker, 'liveedgechange', this.update);
}

this.off(this.player_, ['playing'], this.enableInterval_);
this.off(this.player_, ['ended', 'pause', 'waiting'], this.disableInterval_);

// we don't need to update the play progress if the document is hidden,
// also, this causes the CPU to spike and eventually crash the page on IE11.
if ('hidden' in document && 'visibilityState' in document) {
this.off(document, 'visibilitychange', this.toggleVisibility_);
}

super.dispose();
}
}

/**
Expand Down

0 comments on commit 3ac11d0

Please sign in to comment.