diff --git a/lib/util/periods.js b/lib/util/periods.js index f0e3593ccd..359bc3c466 100644 --- a/lib/util/periods.js +++ b/lib/util/periods.js @@ -399,6 +399,8 @@ shaka.util.PeriodCombiner = class { (streams) => streams.filter((s) => s.type == ContentType.VIDEO)); const textStreamDbsPerPeriod = streamDbsPerPeriod.map( (streams) => streams.filter((s) => s.type == ContentType.TEXT)); + const imageStreamDbsPerPeriod = streamDbsPerPeriod.map( + (streams) => streams.filter((s) => s.type == ContentType.IMAGE)); // It's okay to have a period with no text, but our algorithm fails on any // period without matching streams. So we add dummy text streams to each @@ -429,6 +431,13 @@ shaka.util.PeriodCombiner = class { shaka.util.PeriodCombiner.cloneStreamDB_, shaka.util.PeriodCombiner.concatenateStreamDBs_); + const combinedImageStreamDbs = await shaka.util.PeriodCombiner.combine_( + /* outputStreams= */ [], + imageStreamDbsPerPeriod, + /* firstNewPeriodIndex= */ 0, + shaka.util.PeriodCombiner.cloneStreamDB_, + shaka.util.PeriodCombiner.concatenateStreamDBs_); + // Recreate variantIds from scratch in the output. // HLS content is always single-period, so the early return at the top of // this method would catch all HLS content. DASH content stored with v3.0 @@ -457,7 +466,8 @@ shaka.util.PeriodCombiner = class { return combinedVideoStreamDbs .concat(combinedAudioStreamDbs) - .concat(combinedTextStreamDbs); + .concat(combinedTextStreamDbs) + .concat(combinedImageStreamDbs); } /**