Skip to content

Commit 4f4f6b1

Browse files
committed
fix: Load image streams for offline multiperiod
When loading offline content, we should load the image streams as well. Issue shaka-project#3383 Change-Id: I8cdd3d1ade188b7b2278a0eac5510a968229c6fc
1 parent 42674be commit 4f4f6b1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/util/periods.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ shaka.util.PeriodCombiner = class {
399399
(streams) => streams.filter((s) => s.type == ContentType.VIDEO));
400400
const textStreamDbsPerPeriod = streamDbsPerPeriod.map(
401401
(streams) => streams.filter((s) => s.type == ContentType.TEXT));
402+
const imageStreamDbsPerPeriod = streamDbsPerPeriod.map(
403+
(streams) => streams.filter((s) => s.type == ContentType.IMAGE));
402404

403405
// It's okay to have a period with no text, but our algorithm fails on any
404406
// period without matching streams. So we add dummy text streams to each
@@ -429,6 +431,13 @@ shaka.util.PeriodCombiner = class {
429431
shaka.util.PeriodCombiner.cloneStreamDB_,
430432
shaka.util.PeriodCombiner.concatenateStreamDBs_);
431433

434+
const combinedImageStreamDbs = await shaka.util.PeriodCombiner.combine_(
435+
/* outputStreams= */ [],
436+
imageStreamDbsPerPeriod,
437+
/* firstNewPeriodIndex= */ 0,
438+
shaka.util.PeriodCombiner.cloneStreamDB_,
439+
shaka.util.PeriodCombiner.concatenateStreamDBs_);
440+
432441
// Recreate variantIds from scratch in the output.
433442
// HLS content is always single-period, so the early return at the top of
434443
// this method would catch all HLS content. DASH content stored with v3.0
@@ -457,7 +466,8 @@ shaka.util.PeriodCombiner = class {
457466

458467
return combinedVideoStreamDbs
459468
.concat(combinedAudioStreamDbs)
460-
.concat(combinedTextStreamDbs);
469+
.concat(combinedTextStreamDbs)
470+
.concat(combinedImageStreamDbs);
461471
}
462472

463473
/**

0 commit comments

Comments
 (0)