Skip to content

Commit

Permalink
feat: Create segmentIndex when there is only one variant
Browse files Browse the repository at this point in the history
Related to #6383
  • Loading branch information
avelad committed Jan 10, 2025
1 parent 0eedbc9 commit e3b50b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
13 changes: 0 additions & 13 deletions lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,19 +1061,6 @@ shaka.hls.HlsParser = class {
}

this.playerInterface_.makeTextStreamsForClosedCaptions(this.manifest_);

if (variants.length == 1) {
const createSegmentIndexPromises = [];
const variant = variants[0];
for (const stream of [variant.video, variant.audio]) {
if (stream && !stream.segmentIndex) {
createSegmentIndexPromises.push(stream.createSegmentIndex());
}
}
if (createSegmentIndexPromises.length > 0) {
await Promise.all(createSegmentIndexPromises);
}
}
}

/**
Expand Down
13 changes: 13 additions & 0 deletions lib/media/preload_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,19 @@ shaka.media.PreloadManager = class extends shaka.util.FakeEventTarget {
if (!this.manifest_) {
this.manifest_ = await this.parser_.start(
this.assetUri_, this.manifestPlayerInterface_);

if (this.manifest_.variants.length == 1) {
const createSegmentIndexPromises = [];
const variant = this.manifest_.variants[0];
for (const stream of [variant.video, variant.audio]) {
if (stream && !stream.segmentIndex) {
createSegmentIndexPromises.push(stream.createSegmentIndex());
}
}
if (createSegmentIndexPromises.length > 0) {
await Promise.all(createSegmentIndexPromises);
}
}
}

this.manifestPromise_.resolve();
Expand Down

0 comments on commit e3b50b8

Please sign in to comment.