Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replaceSegmentsUntil flag resetting too early #1444

Merged
merged 4 commits into from
Nov 27, 2023
Merged
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
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 @@
// ...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 @@
* operation is complete
*/
resetEverything(done) {
this.replaceSegmentsUntil_ = null;
this.resetLoaderProperties();
this.resetLoader();

Expand Down Expand Up @@ -3072,8 +3073,8 @@
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;

Check warning on line 3077 in src/segment-loader.js

View check run for this annotation

Codecov / codecov/patch

src/segment-loader.js#L3077

Added line #L3077 was not covered by tests
this.fetchAtBuffer_ = true;
}
if (this.currentTimeline_ !== segmentInfo.timeline) {
Expand Down