Skip to content

Commit

Permalink
fix: replaceSegmentsUntil flag resetting too early (#1444)
Browse files Browse the repository at this point in the history
* fix: replaceSegmentsUntil flag resetting too early

* fix: add null check

* fix: clear replace until during reset everything

---------

Co-authored-by: Dzianis Dashkevich <[email protected]>
  • Loading branch information
adrums86 and Dzianis Dashkevich authored Nov 27, 2023
1 parent b22f6f1 commit af39ba5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/segment-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ export default class SegmentLoader extends videojs.EventTarget {
// ...for determining the fetch location
this.fetchAtBuffer_ = false;
// For comparing with currentTime when overwriting segments on fastQualityChange_ changes. Use -1 as the inactive flag.
this.replaceSegmentsUntil_ = -1;
this.replaceSegmentsUntil_ = null;

this.logger_ = logger(`SegmentLoader[${this.loaderType_}]`);

Expand Down Expand Up @@ -1189,6 +1189,7 @@ export default class SegmentLoader extends videojs.EventTarget {
* operation is complete
*/
resetEverything(done) {
this.replaceSegmentsUntil_ = null;
this.resetLoaderProperties();
this.resetLoader();

Expand Down Expand Up @@ -3072,8 +3073,8 @@ export default class SegmentLoader extends videojs.EventTarget {
this.logger_(`Appended ${segmentInfoString(segmentInfo)}`);

this.addSegmentMetadataCue_(segmentInfo);
if (this.currentTime_() >= this.replaceSegmentsUntil_) {
this.replaceSegmentsUntil_ = -1;
if (this.replaceSegmentsUntil_ !== null && this.currentTime_() >= this.replaceSegmentsUntil_) {
this.replaceSegmentsUntil_ = null;
this.fetchAtBuffer_ = true;
}
if (this.currentTimeline_ !== segmentInfo.timeline) {
Expand Down

0 comments on commit af39ba5

Please sign in to comment.