From 56bd0d89f5521a169d91dbd40825bb71a5afad43 Mon Sep 17 00:00:00 2001 From: Theodore Abshire Date: Thu, 21 Oct 2021 11:04:06 -0700 Subject: [PATCH] fix(dash): Fix seek range issues on transition from live to VOD Before, when using SegmentTemplate or SegmentList, we would tell the presentation timeline about new segments only when we saw a new period or representation. This meant that, in live streams, if new content was being added to the SegmentTemplate or SegmentList, the presentation timeline was not being kept abreast of the changes. Thus, if that stream were to then transition to VOD, the presentation timeline would suddenly start to report that the current time was beyond the end of the seek range, which caused playback to stop. Closes #3675 Change-Id: I77ef00c5a86de9ebcb86f18f792084ed70f94e8d --- lib/dash/segment_list.js | 2 +- lib/dash/segment_template.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dash/segment_list.js b/lib/dash/segment_list.js index 11a24a8a41..795e8ee890 100644 --- a/lib/dash/segment_list.js +++ b/lib/dash/segment_list.js @@ -63,12 +63,12 @@ shaka.dash.SegmentList = class { const start = context.presentationTimeline.getSegmentAvailabilityStart(); segmentIndex.mergeAndEvict(references, start); } else { - context.presentationTimeline.notifySegments(references); segmentIndex = new shaka.media.SegmentIndex(references); if (id && context.dynamic) { segmentIndexMap[id] = segmentIndex; } } + context.presentationTimeline.notifySegments(references); if (!context.dynamic || !context.periodInfo.isLastPeriod) { const periodStart = context.periodInfo.start; diff --git a/lib/dash/segment_template.js b/lib/dash/segment_template.js index 275993e564..ee985556f4 100644 --- a/lib/dash/segment_template.js +++ b/lib/dash/segment_template.js @@ -116,12 +116,12 @@ shaka.dash.SegmentTemplate = class { segmentIndex.mergeAndEvict(references, context.presentationTimeline.getSegmentAvailabilityStart()); } else { - context.presentationTimeline.notifySegments(references); segmentIndex = new shaka.media.SegmentIndex(references); if (id && context.dynamic) { segmentIndexMap[id] = segmentIndex; } } + context.presentationTimeline.notifySegments(references); if (shouldFit) { segmentIndex.fit(periodStart, periodEnd);