From 09a72bcb2915724c9451d40437d2236a094f2d51 Mon Sep 17 00:00:00 2001 From: Adam Waldron Date: Wed, 8 Nov 2023 14:48:29 -0800 Subject: [PATCH 1/3] fix: replaceSegmentsUntil flag resetting too early --- src/segment-loader.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/segment-loader.js b/src/segment-loader.js index b67c4984c..d54452d40 100644 --- a/src/segment-loader.js +++ b/src/segment-loader.js @@ -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_}]`); @@ -3072,8 +3072,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_ && this.currentTime_() >= this.replaceSegmentsUntil_) { + this.replaceSegmentsUntil_ = null; this.fetchAtBuffer_ = true; } if (this.currentTimeline_ !== segmentInfo.timeline) { From 4f873ecb44b491ab7f9f6a0f1157f76530e14087 Mon Sep 17 00:00:00 2001 From: Dzianis Dashkevich Date: Mon, 27 Nov 2023 16:12:29 -0500 Subject: [PATCH 2/3] fix: add null check --- src/segment-loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/segment-loader.js b/src/segment-loader.js index d54452d40..01b4a3a97 100644 --- a/src/segment-loader.js +++ b/src/segment-loader.js @@ -3072,7 +3072,7 @@ export default class SegmentLoader extends videojs.EventTarget { this.logger_(`Appended ${segmentInfoString(segmentInfo)}`); this.addSegmentMetadataCue_(segmentInfo); - if (this.replaceSegmentsUntil_ && this.currentTime_() >= this.replaceSegmentsUntil_) { + if (this.replaceSegmentsUntil_ !== null && this.currentTime_() >= this.replaceSegmentsUntil_) { this.replaceSegmentsUntil_ = null; this.fetchAtBuffer_ = true; } From e445ec426b4bff6412da48978b18ddb2a1b8afbe Mon Sep 17 00:00:00 2001 From: Dzianis Dashkevich Date: Mon, 27 Nov 2023 16:29:37 -0500 Subject: [PATCH 3/3] fix: clear replace until during reset everything --- src/segment-loader.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/segment-loader.js b/src/segment-loader.js index 01b4a3a97..70121dcdf 100644 --- a/src/segment-loader.js +++ b/src/segment-loader.js @@ -1189,6 +1189,7 @@ export default class SegmentLoader extends videojs.EventTarget { * operation is complete */ resetEverything(done) { + this.replaceSegmentsUntil_ = null; this.resetLoaderProperties(); this.resetLoader();