diff --git a/lib/dash.js b/lib/dash.js index 65b6e63..fb37833 100644 --- a/lib/dash.js +++ b/lib/dash.js @@ -173,10 +173,14 @@ const parseSegmentsFromTemplate = ( const startNumber = Number(segmentTemplate.get('startNumber') || 1); const segmentTimeline = segmentTemplate.get('SegmentTimeline'); resolveSegmentTemplateUrls(segmentTemplate, baseUrl, manifestUrl); - if (!duration) throw new Error('Duration of the Period was unable to be determined.'); const segmentDuration = parseFloat(segmentTemplate.get('duration')); const segmentTimescale = parseFloat(segmentTemplate.get('timescale') || 1); - const segmentsCount = Math.ceil(duration / (segmentDuration / segmentTimescale)); + // TODO: Support live manifests with type=dynamic + const DEFAULT_SEGMENTS_COUNT = 35; + // if (!duration) throw new Error('Duration of the Period was unable to be determined.'); + const segmentsCount = duration + ? Math.ceil(duration / (segmentDuration / segmentTimescale)) + : DEFAULT_SEGMENTS_COUNT; const bandwidth = representation.get('bandwidth'); const id = representation.get('id'); const segments = [];