Skip to content

Commit

Permalink
set the timer to half target duration
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev committed Oct 14, 2020
1 parent 52126f5 commit f4315d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/master-playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,11 @@ export class MasterPlaylistController extends videojs.EventTarget {
// if we shouldn't switch to the next playlist, do nothing
if (!this.shouldSwitchToMedia_(nextPlaylist)) {
this.logger_(`earlyabort triggered, but we will not be switching from ${currentPlaylist.id} -> ${nextPlaylist.id}.`);
// try again in half the target duration to make sure that we
// have an opportunity to switch
this.mainSegmentLoader_.earlyabortTimer_ = window.setTimeout(() => {
this.mainSegmentLoader_.trigger('earlyabort');
}, 10 * 1000);
}, (this.media().targetDuration / 2) * 1000);
return;
}
}
Expand Down

0 comments on commit f4315d1

Please sign in to comment.