Skip to content

Commit

Permalink
fix(DASH): Notify time range with the fitted timeline (#7911)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored Jan 21, 2025
1 parent 87d9392 commit a89ee1a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/dash/segment_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ shaka.dash.SegmentTemplate = class {
if (info.timeline &&
context.adaptationSet.contentType !== 'image' &&
context.adaptationSet.contentType !== 'text') {
const timeline = info.timeline;
const tsi = /** @type {!TimelineSegmentIndex} */(segmentIndex);
// getTimeline is the info.timeline but fitted to the period.
const timeline = tsi.getTimeline();
context.presentationTimeline.notifyTimeRange(
timeline,
periodStart);
Expand Down Expand Up @@ -934,6 +936,19 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
// find/get() methods whenever possible.
}

/**
* Get the current timeline
* @return {!Array<shaka.media.PresentationTimeline.TimeRange>}
*/
getTimeline() {
if (!this.templateInfo_) {
return [];
}
const timeline = this.templateInfo_.timeline;
goog.asserts.assert(timeline, 'Timeline should be non-null!');
return timeline;
}

/**
* @override
*/
Expand Down

0 comments on commit a89ee1a

Please sign in to comment.