From d8b642a8f1adec18e5130a64d5ffb50d0a92ce8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Mon, 20 Jan 2025 14:28:54 +0100 Subject: [PATCH 1/2] fix(DASH): Notify time range with the fitted timeline --- lib/dash/segment_template.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/dash/segment_template.js b/lib/dash/segment_template.js index 4ff063aba9..726aaf9f1e 100644 --- a/lib/dash/segment_template.js +++ b/lib/dash/segment_template.js @@ -158,7 +158,8 @@ shaka.dash.SegmentTemplate = class { if (info.timeline && context.adaptationSet.contentType !== 'image' && context.adaptationSet.contentType !== 'text') { - const timeline = info.timeline; + const tsi = /** @type {!TimelineSegmentIndex} */(segmentIndex); + const timeline = tsi.getTimeline(); context.presentationTimeline.notifyTimeRange( timeline, periodStart); @@ -934,6 +935,19 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex { // find/get() methods whenever possible. } + /** + * Get the current timeline + * @return {!Array} + */ + getTimeline() { + if (!this.templateInfo_) { + return []; + } + const timeline = this.templateInfo_.timeline; + goog.asserts.assert(timeline, 'Timeline should be non-null!'); + return timeline; + } + /** * @override */ From 6b2d00e432dd02841e7be35fdad0683a4cc2b33b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Tue, 21 Jan 2025 08:20:07 +0100 Subject: [PATCH 2/2] Add comment --- lib/dash/segment_template.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dash/segment_template.js b/lib/dash/segment_template.js index 726aaf9f1e..88414f2c35 100644 --- a/lib/dash/segment_template.js +++ b/lib/dash/segment_template.js @@ -159,6 +159,7 @@ shaka.dash.SegmentTemplate = class { context.adaptationSet.contentType !== 'image' && context.adaptationSet.contentType !== 'text') { const tsi = /** @type {!TimelineSegmentIndex} */(segmentIndex); + // getTimeline is the info.timeline but fitted to the period. const timeline = tsi.getTimeline(); context.presentationTimeline.notifyTimeRange( timeline,