Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/client-side/player-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ const PlayerWrapper = function(player, adsPluginSettings, controller) {
* Set up the intervals we use on the player.
*/
PlayerWrapper.prototype.setUpPlayerIntervals = function() {
/**
* Clear old interval handers in case the method was called more than once
*/
clearInterval(this.updateTimeIntervalHandle);
clearInterval(this.seekCheckIntervalHandle);
clearInterval(this.resizeCheckIntervalHandle);

this.updateTimeIntervalHandle =
setInterval(this.updateCurrentTime.bind(this), this.updateTimeInterval);
this.seekCheckIntervalHandle =
Expand Down Expand Up @@ -225,9 +232,6 @@ PlayerWrapper.prototype.localContentEndedListener = function() {
}
}

clearInterval(this.updateTimeIntervalHandle);
clearInterval(this.seekCheckIntervalHandle);
clearInterval(this.resizeCheckIntervalHandle);
if (this.vjsPlayer.el()) {
this.vjsPlayer.one('play', this.setUpPlayerIntervals.bind(this));
}
Expand Down