From 8fa63992d7bf825791a2b0838d6f229f26460d70 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Tue, 10 Dec 2019 14:50:35 -0500 Subject: [PATCH 1/4] feat: expose suggestPresentationDelay if the type is dynamic --- src/parseAttributes.js | 26 ++++++++++++++++++++++++++ src/toM3u8.js | 6 ++++++ 2 files changed, 32 insertions(+) diff --git a/src/parseAttributes.js b/src/parseAttributes.js index ba8c36f8..371da61d 100644 --- a/src/parseAttributes.js +++ b/src/parseAttributes.js @@ -43,6 +43,32 @@ export const parsers = { return parseDuration(value); }, + /** + * Specifies the suggested presentation delay. Format is a + * duration string as specified in ISO 8601 + * + * @param {string} value + * value of attribute as a string + * @return {number} + * The duration in seconds + */ + suggestedPresentationDelay(value) { + return parseDuration(value); + }, + + /** + * specifices the type of mpd. Can be either "static" or "dynamic" + * + * @param {string} value + * value of attribute as a string + * + * @return {string} + * The type as a string + */ + type(value) { + return value; + }, + /** * Specifies the duration of the smallest time shifting buffer for any Representation * in the MPD. Format is a duration string as specified in ISO 8601 diff --git a/src/toM3u8.js b/src/toM3u8.js index ea692602..a44ea1cb 100644 --- a/src/toM3u8.js +++ b/src/toM3u8.js @@ -239,6 +239,8 @@ export const toM3u8 = (dashPlaylists, sidxMapping = {}) => { // grab all master attributes const { sourceDuration: duration, + type = 'static', + suggestedPresentationDelay = 0, minimumUpdatePeriod = 0 } = dashPlaylists[0].attributes; @@ -270,6 +272,10 @@ export const toM3u8 = (dashPlaylists, sidxMapping = {}) => { minimumUpdatePeriod: minimumUpdatePeriod * 1000 }; + if (type === 'dynamic') { + master.suggestedPresentationDelay = suggestedPresentationDelay; + } + if (audioPlaylists.length) { master.mediaGroups.AUDIO.audio = organizeAudioPlaylists(audioPlaylists, sidxMapping); } From ed3f3e528f7a2d400a2a2a2ac3409f6bbfc76583 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Wed, 11 Dec 2019 14:00:28 -0500 Subject: [PATCH 2/4] default to no suggested presentation delay --- src/toM3u8.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/toM3u8.js b/src/toM3u8.js index a44ea1cb..a5aeacc8 100644 --- a/src/toM3u8.js +++ b/src/toM3u8.js @@ -240,7 +240,7 @@ export const toM3u8 = (dashPlaylists, sidxMapping = {}) => { const { sourceDuration: duration, type = 'static', - suggestedPresentationDelay = 0, + suggestedPresentationDelay, minimumUpdatePeriod = 0 } = dashPlaylists[0].attributes; From fda7b4937a8eced86f653f3d82576b2916df3900 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Mon, 3 Feb 2020 15:19:53 -0500 Subject: [PATCH 3/4] add toM3u8 test --- test/toM3u8.test.js | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/test/toM3u8.test.js b/test/toM3u8.test.js index 8d5d4fcb..66c2abc5 100644 --- a/test/toM3u8.test.js +++ b/test/toM3u8.test.js @@ -550,3 +550,67 @@ QUnit.test('playlists with sidx and sidxMapping', function(assert) { QUnit.test('no playlists', function(assert) { assert.deepEqual(toM3u8([]), {}); }); + +QUnit.test('dynamic playlists with suggestedPresentationDelay', function(assert) { + const input = [{ + attributes: { + id: '1', + codecs: 'foo;bar', + sourceDuration: 100, + duration: 0, + bandwidth: 20000, + periodIndex: 1, + mimeType: 'audio/mp4', + type: 'dynamic', + suggestedPresentationDelay: 18 + }, + segments: [] + }, { + attributes: { + id: '2', + codecs: 'foo;bar', + sourceDuration: 100, + duration: 0, + bandwidth: 10000, + periodIndex: 1, + mimeType: 'audio/mp4' + }, + segments: [] + }, { + attributes: { + sourceDuration: 100, + id: '1', + width: 800, + height: 600, + codecs: 'foo;bar', + duration: 0, + bandwidth: 10000, + periodIndex: 1, + mimeType: 'video/mp4' + }, + segments: [] + }, { + attributes: { + sourceDuration: 100, + id: '1', + bandwidth: 20000, + periodIndex: 1, + mimeType: 'text/vtt', + baseUrl: 'https://www.example.com/vtt' + } + }, { + attributes: { + sourceDuration: 100, + id: '1', + bandwidth: 10000, + periodIndex: 1, + mimeType: 'text/vtt', + baseUrl: 'https://www.example.com/vtt' + } + }]; + + const output = toM3u8(input); + + assert.ok('suggestedPresentationDelay' in output); + assert.deepEqual(output.suggestedPresentationDelay, 18); +}); From 1bfff2eb892fd6589e731326f186ab84c7030dda Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Mon, 3 Feb 2020 15:39:16 -0500 Subject: [PATCH 4/4] add dynamic+suggestPresentationDelay manifest fixture --- test/index.test.js | 8 + test/manifests/multiperiod-dynamic.js | 953 +++++++++++++++++++++++++ test/manifests/multiperiod-dynamic.mpd | 143 ++++ 3 files changed, 1104 insertions(+) create mode 100644 test/manifests/multiperiod-dynamic.js create mode 100644 test/manifests/multiperiod-dynamic.mpd diff --git a/test/index.test.js b/test/index.test.js index 19912ab4..8f03eb0e 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -6,6 +6,7 @@ import maatVttSegmentTemplate from './manifests/maat_vtt_segmentTemplate.mpd'; import segmentBaseTemplate from './manifests/segmentBase.mpd'; import segmentListTemplate from './manifests/segmentList.mpd'; import multiperiod from './manifests/multiperiod.mpd'; +import multiperiodDynamic from './manifests/multiperiod-dynamic.mpd'; import { parsedManifest as maatVttSegmentTemplateManifest } from './manifests/maat_vtt_segmentTemplate.js'; @@ -18,6 +19,9 @@ import { import { parsedManifest as multiperiodManifest } from './manifests/multiperiod.js'; +import { + parsedManifest as multiperiodDynamicManifest +} from './manifests/multiperiod-dynamic.js'; QUnit.module('mpd-parser'); @@ -45,6 +49,10 @@ QUnit.test('has parse', function(assert) { name: 'multiperiod', input: multiperiod, expected: multiperiodManifest +}, { + name: 'multiperiod_dynamic', + input: multiperiodDynamic, + expected: multiperiodDynamicManifest }].forEach(({ name, input, expected }) => { QUnit.test(`${name} test manifest`, function(assert) { const actual = parse(input); diff --git a/test/manifests/multiperiod-dynamic.js b/test/manifests/multiperiod-dynamic.js new file mode 100644 index 00000000..06d4f514 --- /dev/null +++ b/test/manifests/multiperiod-dynamic.js @@ -0,0 +1,953 @@ +export const parsedManifest = { + allowCache: true, + discontinuityStarts: [], + segments: [], + endList: true, + mediaGroups: { + 'AUDIO': { + audio: { + 'en (main)': { + language: 'en', + autoselect: true, + default: true, + playlists: [{ + attributes: { + 'NAME': 'default_audio128_2', + 'BANDWIDTH': 123000, + 'CODECS': 'mp4a.40.2', + 'PROGRAM-ID': 1 + }, + uri: '', + endList: false, + timeline: 0, + resolvedUri: '', + targetDuration: 2, + segments: [{ + uri: 'https://example.com/default_audio128_2/segment0.m4f', + timeline: 0, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment0.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init0.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init0.m4f' + }, + number: 0 + }, { + uri: 'https://example.com/default_audio128_2/segment1.m4f', + timeline: 0, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment1.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init0.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init0.m4f' + }, + number: 1 + }, { + uri: 'https://example.com/default_audio128_2/segment2.m4f', + timeline: 0, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment2.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init0.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init0.m4f' + }, + number: 2 + }, { + uri: 'https://example.com/default_audio128_2/segment3.m4f', + timeline: 1, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment3.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init1.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init1.m4f' + }, + number: 3, + discontinuity: true + }, { + uri: 'https://example.com/default_audio128_2/segment4.m4f', + timeline: 1, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment4.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init1.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init1.m4f' + }, + number: 4 + }, { + uri: 'https://example.com/default_audio128_2/segment5.m4f', + timeline: 1, + duration: 0.8591383219954648, + resolvedUri: 'https://example.com/default_audio128_2/segment5.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init1.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init1.m4f' + }, + number: 5 + }, { + uri: 'https://example.com/default_audio128_2/segment6.m4f', + timeline: 2, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment6.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init2.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' + }, + number: 6, + discontinuity: true + }, { + uri: 'https://example.com/default_audio128_2/segment7.m4f', + timeline: 2, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment7.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init2.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' + }, + number: 7 + }, { + uri: 'https://example.com/default_audio128_2/segment8.m4f', + timeline: 2, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment8.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init2.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' + }, + number: 8 + }, { + uri: 'https://example.com/default_audio128_2/segment9.m4f', + timeline: 2, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment9.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init2.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' + }, + number: 9 + }, { + uri: 'https://example.com/default_audio128_2/segment10.m4f', + timeline: 2, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment10.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init2.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' + }, + number: 10 + }, { + uri: 'https://example.com/default_audio128_2/segment11.m4f', + timeline: 2, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment11.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init2.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' + }, + number: 11 + }, { + uri: 'https://example.com/default_audio128_2/segment12.m4f', + timeline: 2, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment12.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init2.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' + }, + number: 12 + }, { + uri: 'https://example.com/default_audio128_2/segment13.m4f', + timeline: 2, + duration: 0.023219954648526078, + resolvedUri: 'https://example.com/default_audio128_2/segment13.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init2.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init2.m4f' + }, + number: 13 + }, { + uri: 'https://example.com/default_audio128_2/segment14.m4f', + timeline: 3, + duration: 1.1609977324263039, + resolvedUri: 'https://example.com/default_audio128_2/segment14.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init3.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init3.m4f' + }, + number: 14, + discontinuity: true + }, { + uri: 'https://example.com/default_audio128_2/segment15.m4f', + timeline: 3, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment15.m4f', + map: { + uri: 'https://example.com/default_audio128_2/init3.m4f', + resolvedUri: 'https://example.com/default_audio128_2/init3.m4f' + }, + number: 15 + }, { + uri: 'https://example.com/default_audio128_2/segment16.m4f', + timeline: 4, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment16.m4f', + map: { + uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' + }, + number: 16, + discontinuity: true + }, { + uri: 'https://example.com/default_audio128_2/segment17.m4f', + timeline: 4, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment17.m4f', + map: { + uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' + }, + number: 17 + }, { + uri: 'https://example.com/default_audio128_2/segment18.m4f', + timeline: 4, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment18.m4f', + map: { + uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' + }, + number: 18 + }, { + uri: 'https://example.com/default_audio128_2/segment19.m4f', + timeline: 4, + duration: 1.9969160997732427, + resolvedUri: 'https://example.com/default_audio128_2/segment19.m4f', + map: { + uri: 'https://example.com/default_audio128_2/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_audio128_2/segment$Number$.m4f' + }, + number: 19 + }], + mediaSequence: 0, + contentProtection: { + 'com.widevine.alpha': { + attributes: { + schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' + }, + pssh: new Uint8Array([181, 235, 45]) + } + } + }], + uri: '' + } + } + }, + 'VIDEO': {}, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + uri: '', + duration: 36.269, + playlists: [{ + attributes: { + 'NAME': 'default_video2000_0_1280x720', + 'AUDIO': 'audio', + 'SUBTITLES': 'subs', + 'RESOLUTION': { + width: 1280, + height: 720 + }, + 'CODECS': 'avc1.4d001f', + 'BANDWIDTH': 2008E3, + 'PROGRAM-ID': 1 + }, + uri: '', + endList: false, + timeline: 0, + resolvedUri: '', + targetDuration: 3, + segments: [{ + uri: 'https://example.com/default_video2000_0_1280x720/segment0.m4f', + timeline: 0, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment0.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init0.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init0.m4f' + }, + number: 0 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment1.m4f', + timeline: 0, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment1.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init0.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init0.m4f' + }, + number: 1 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment2.m4f', + timeline: 0, + duration: 1.9686333333333332, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment2.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init0.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init0.m4f' + }, + number: 2 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment3.m4f', + timeline: 1, + duration: 1.9352666666666667, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment3.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init1.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init1.m4f' + }, + number: 3, + discontinuity: true + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment4.m4f', + timeline: 1, + duration: 1.9352666666666667, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment4.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init1.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init1.m4f' + }, + number: 4 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment5.m4f', + timeline: 1, + duration: 0.9676333333333333, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment5.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init1.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init1.m4f' + }, + number: 5 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment6.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment6.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' + }, + number: 6, + discontinuity: true + }, + { + uri: 'https://example.com/default_video2000_0_1280x720/segment7.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment7.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' + }, + number: 7 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment8.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment8.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' + }, + number: 8 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment9.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment9.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' + }, + number: 9 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment10.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment10.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' + }, + number: 10 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment11.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment11.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' + }, + number: 11 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment12.m4f', + timeline: 2, + duration: 1.9686333333333332, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment12.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init2.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init2.m4f' + }, + number: 12 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment13.m4f', + timeline: 3, + duration: 0.9676333333333333, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment13.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init3.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init3.m4f' + }, + number: 13, + discontinuity: true + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment14.m4f', + timeline: 3, + duration: 1.9352666666666667, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment14.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init3.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init3.m4f' + }, + number: 14 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment15.m4f', + timeline: 3, + duration: 0.26693333333333336, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment15.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/init3.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/init3.m4f' + }, + number: 15 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment16.m4f', + timeline: 4, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment16.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' + }, + number: 16, + discontinuity: true + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment17.m4f', + timeline: 4, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment17.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' + }, + number: 17 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment18.m4f', + timeline: 4, + duration: 2.002, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment18.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' + }, + number: 18 + }, { + uri: 'https://example.com/default_video2000_0_1280x720/segment19.m4f', + timeline: 4, + duration: 1.9686333333333332, + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment19.m4f', + map: { + uri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video2000_0_1280x720/segment$Number$.m4f' + }, + number: 19 + }], + mediaSequence: 0, + contentProtection: { + 'com.widevine.alpha': { + attributes: { + schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' + }, + pssh: new Uint8Array([181, 235, 45]) + } + } + }, { + attributes: { + 'NAME': 'default_video1200_1_960x540', + 'AUDIO': 'audio', + 'SUBTITLES': 'subs', + 'RESOLUTION': { + width: 960, + height: 540 + }, + 'CODECS': 'avc1.4d001f', + 'BANDWIDTH': 1195E3, + 'PROGRAM-ID': 1 + }, + uri: '', + endList: false, + timeline: 0, + resolvedUri: '', + targetDuration: 3, + segments: [{ + uri: 'https://example.com/default_video1200_1_960x540/segment0.m4f', + timeline: 0, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment0.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init0.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init0.m4f' + }, + number: 0 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment1.m4f', + timeline: 0, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment1.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init0.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init0.m4f' + }, + number: 1 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment2.m4f', + timeline: 0, + duration: 1.9686333333333332, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment2.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init0.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init0.m4f' + }, + number: 2 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment3.m4f', + timeline: 1, + duration: 1.9352666666666667, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment3.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init1.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init1.m4f' + }, + number: 3, + discontinuity: true + }, + { + uri: 'https://example.com/default_video1200_1_960x540/segment4.m4f', + timeline: 1, + duration: 1.9352666666666667, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment4.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init1.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init1.m4f' + }, + number: 4 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment5.m4f', + timeline: 1, + duration: 0.9676333333333333, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment5.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init1.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init1.m4f' + }, + number: 5 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment6.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment6.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' + }, + number: 6, + discontinuity: true + }, + { + uri: 'https://example.com/default_video1200_1_960x540/segment7.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment7.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' + }, + number: 7 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment8.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment8.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' + }, + number: 8 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment9.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment9.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' + }, + number: 9 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment10.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment10.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' + }, + number: 10 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment11.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment11.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' + }, + number: 11 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment12.m4f', + timeline: 2, + duration: 1.9686333333333332, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment12.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init2.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init2.m4f' + }, + number: 12 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment13.m4f', + timeline: 3, + duration: 0.9676333333333333, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment13.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init3.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init3.m4f' + }, + number: 13, + discontinuity: true + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment14.m4f', + timeline: 3, + duration: 1.9352666666666667, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment14.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init3.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init3.m4f' + }, + number: 14 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment15.m4f', + timeline: 3, + duration: 0.26693333333333336, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment15.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/init3.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/init3.m4f' + }, + number: 15 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment16.m4f', + timeline: 4, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment16.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' + }, + number: 16, + discontinuity: true + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment17.m4f', + timeline: 4, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment17.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' + }, + number: 17 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment18.m4f', + timeline: 4, + duration: 2.002, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment18.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' + }, + number: 18 + }, { + uri: 'https://example.com/default_video1200_1_960x540/segment19.m4f', + timeline: 4, + duration: 1.9686333333333332, + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment19.m4f', + map: { + uri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video1200_1_960x540/segment$Number$.m4f' + }, + number: 19 + }], + mediaSequence: 0, + contentProtection: { + 'com.widevine.alpha': { + attributes: { + schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' + }, + pssh: new Uint8Array([181, 235, 45]) + } + } + }, { + attributes: { + 'NAME': 'default_video900_1_640x360', + 'AUDIO': 'audio', + 'SUBTITLES': 'subs', + 'RESOLUTION': { + width: 640, + height: 360 + }, + 'CODECS': 'avc1.4d001e', + 'BANDWIDTH': 884E3, + 'PROGRAM-ID': 1 + }, + uri: '', + endList: false, + timeline: 0, + resolvedUri: '', + targetDuration: 3, + segments: [{ + uri: 'https://example.com/default_video900_1_640x360/segment0.m4f', + timeline: 0, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment0.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init0.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init0.m4f' + }, + number: 0 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment1.m4f', + timeline: 0, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment1.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init0.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init0.m4f' + }, + number: 1 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment2.m4f', + timeline: 0, + duration: 1.9686333333333332, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment2.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init0.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init0.m4f' + }, + number: 2 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment3.m4f', + timeline: 1, + duration: 1.9352666666666667, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment3.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init1.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init1.m4f' + }, + number: 3, + discontinuity: true + }, + { + uri: 'https://example.com/default_video900_1_640x360/segment4.m4f', + timeline: 1, + duration: 1.9352666666666667, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment4.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init1.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init1.m4f' + }, + number: 4 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment5.m4f', + timeline: 1, + duration: 0.9676333333333333, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment5.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init1.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init1.m4f' + }, + number: 5 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment6.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment6.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init2.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' + }, + number: 6, + discontinuity: true + }, { + uri: 'https://example.com/default_video900_1_640x360/segment7.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment7.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init2.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' + }, + number: 7 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment8.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment8.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init2.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' + }, + number: 8 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment9.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment9.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init2.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' + }, + number: 9 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment10.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment10.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init2.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' + }, + number: 10 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment11.m4f', + timeline: 2, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment11.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init2.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' + }, + number: 11 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment12.m4f', + timeline: 2, + duration: 1.9686333333333332, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment12.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init2.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init2.m4f' + }, + number: 12 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment13.m4f', + timeline: 3, + duration: 0.9676333333333333, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment13.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init3.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init3.m4f' + }, + number: 13, + discontinuity: true + }, { + uri: 'https://example.com/default_video900_1_640x360/segment14.m4f', + timeline: 3, + duration: 1.9352666666666667, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment14.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init3.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init3.m4f' + }, + number: 14 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment15.m4f', + timeline: 3, + duration: 0.26693333333333336, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment15.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/init3.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/init3.m4f' + }, + number: 15 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment16.m4f', + timeline: 4, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment16.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' + }, + number: 16, + discontinuity: true + }, { + uri: 'https://example.com/default_video900_1_640x360/segment17.m4f', + timeline: 4, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment17.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' + }, + number: 17 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment18.m4f', + timeline: 4, + duration: 2.002, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment18.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' + }, + number: 18 + }, { + uri: 'https://example.com/default_video900_1_640x360/segment19.m4f', + timeline: 4, + duration: 1.9686333333333332, + resolvedUri: 'https://example.com/default_video900_1_640x360/segment19.m4f', + map: { + uri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f', + resolvedUri: 'https://example.com/default_video900_1_640x360/segment$Number$.m4f' + }, + number: 19 + }], + mediaSequence: 0, + contentProtection: { + 'com.widevine.alpha': { + attributes: { + schemeIdUri: 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed' + }, + pssh: new Uint8Array([181, 235, 45]) + } + } + }], + minimumUpdatePeriod: 0, + suggestedPresentationDelay: 18 +}; diff --git a/test/manifests/multiperiod-dynamic.mpd b/test/manifests/multiperiod-dynamic.mpd new file mode 100644 index 00000000..7e934d0f --- /dev/null +++ b/test/manifests/multiperiod-dynamic.mpd @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + test + + + + + + + + + + + + + + + test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + test + + + + + + + + + + + + + + + test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +