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 d01eef23b1..680b6a163f 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);