From ee6dd4e3761795b39b8a1adabbe107d9c0548a15 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 12 Jul 2021 20:05:33 -0400 Subject: [PATCH 1/2] feat: add raw list of segment lines to manifest --- src/parse-stream.js | 87 +++++++++++------ src/parser.js | 16 ++- test/fixtures/integration/absoluteUris.js | 16 +++ test/fixtures/integration/allowCache.js | 85 ++++++++++++++++ .../fixtures/integration/allowCacheInvalid.js | 5 + test/fixtures/integration/alternateAudio.js | 8 ++ test/fixtures/integration/alternateVideo.js | 4 + test/fixtures/integration/brightcove.js | 16 +++ test/fixtures/integration/byteRange.js | 84 ++++++++++++++++ test/fixtures/integration/dateTime.js | 10 ++ test/fixtures/integration/diff-init-key.js | 44 +++++++++ test/fixtures/integration/disallowCache.js | 5 + test/fixtures/integration/disc-sequence.js | 17 ++++ test/fixtures/integration/discontinuity.js | 39 ++++++++ test/fixtures/integration/domainUris.js | 16 +++ test/fixtures/integration/emptyAllowCache.js | 5 + .../integration/emptyMediaSequence.js | 16 +++ .../fixtures/integration/emptyPlaylistType.js | 24 +++++ .../integration/emptyTargetDuration.js | 16 +++ test/fixtures/integration/encrypted.js | 24 +++++ test/fixtures/integration/event.js | 24 +++++ .../extXPlaylistTypeInvalidPlaylist.js | 4 + test/fixtures/integration/extinf.js | 85 ++++++++++++++++ test/fixtures/integration/fmp4.js | 10 ++ .../fixtures/integration/invalidAllowCache.js | 5 + .../integration/invalidMediaSequence.js | 16 +++ .../integration/invalidPlaylistType.js | 24 +++++ .../integration/invalidTargetDuration.js | 85 ++++++++++++++++ .../integration/liveMissingSegmentDuration.js | 10 ++ .../integration/liveStart30sBefore.js | 36 +++++++ test/fixtures/integration/llhls-byte-range.js | 97 +++++++++++++++++++ .../integration/llhls-delta-byte-range.js | 34 +++++++ test/fixtures/integration/llhls.js | 61 ++++++++++++ test/fixtures/integration/llhlsDelta.js | 49 ++++++++++ .../manifestExtTTargetdurationNegative.js | 4 + .../integration/manifestExtXEndlistEarly.js | 20 ++++ test/fixtures/integration/manifestNoExtM3u.js | 4 + test/fixtures/integration/master-fmp4.js | 96 ++++++++++++++++++ test/fixtures/integration/master.js | 16 +++ test/fixtures/integration/media.js | 16 +++ test/fixtures/integration/mediaSequence.js | 16 +++ test/fixtures/integration/missingEndlist.js | 8 ++ test/fixtures/integration/missingExtinf.js | 11 +++ .../integration/missingMediaSequence.js | 16 +++ .../integration/missingSegmentDuration.js | 13 +++ .../integration/multipleAudioGroups.js | 16 +++ .../multipleAudioGroupsCombinedMain.js | 16 +++ .../integration/multipleTargetDurations.js | 13 +++ test/fixtures/integration/multipleVideo.js | 8 ++ .../integration/negativeMediaSequence.js | 16 +++ test/fixtures/integration/playlist.js | 85 ++++++++++++++++ .../playlistMediaSequenceHigher.js | 4 + test/fixtures/integration/start.js | 16 +++ test/fixtures/integration/streamInfInvalid.js | 8 ++ .../fixtures/integration/twoMediaSequences.js | 16 +++ test/fixtures/integration/versionInvalid.js | 4 + test/fixtures/integration/whiteSpace.js | 16 +++ test/fixtures/integration/zeroDuration.js | 4 + test/parse-stream.test.js | 27 ++++-- 59 files changed, 1506 insertions(+), 40 deletions(-) diff --git a/src/parse-stream.js b/src/parse-stream.js index bee4b33..11178b3 100644 --- a/src/parse-stream.js +++ b/src/parse-stream.js @@ -118,7 +118,8 @@ export default class ParseStream extends Stream { if (line[0] !== '#') { this.trigger('data', { type: 'uri', - uri: line + uri: line, + raw: line }); return; } @@ -146,7 +147,8 @@ export default class ParseStream extends Stream { if (newLine.indexOf('#EXT') !== 0) { this.trigger('data', { type: 'comment', - text: newLine.slice(1) + text: newLine.slice(1), + raw: newLine }); return; } @@ -160,7 +162,8 @@ export default class ParseStream extends Stream { if (match) { this.trigger('data', { type: 'tag', - tagType: 'm3u' + tagType: 'm3u', + raw: newLine }); return; } @@ -168,7 +171,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'inf' + tagType: 'inf', + raw: newLine }; if (match[1]) { event.duration = parseFloat(match[1]); @@ -183,7 +187,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'targetduration' + tagType: 'targetduration', + raw: newLine }; if (match[1]) { event.duration = parseInt(match[1], 10); @@ -195,7 +200,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'version' + tagType: 'version', + raw: newLine }; if (match[1]) { event.version = parseInt(match[1], 10); @@ -207,7 +213,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'media-sequence' + tagType: 'media-sequence', + raw: newLine }; if (match[1]) { event.number = parseInt(match[1], 10); @@ -219,7 +226,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'discontinuity-sequence' + tagType: 'discontinuity-sequence', + raw: newLine }; if (match[1]) { event.number = parseInt(match[1], 10); @@ -231,7 +239,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'playlist-type' + tagType: 'playlist-type', + raw: newLine }; if (match[1]) { event.playlistType = match[1]; @@ -243,7 +252,8 @@ export default class ParseStream extends Stream { if (match) { event = Object.assign(parseByterange(match[1]), { type: 'tag', - tagType: 'byterange' + tagType: 'byterange', + raw: newLine }); this.trigger('data', event); return; @@ -252,7 +262,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'allow-cache' + tagType: 'allow-cache', + raw: newLine }; if (match[1]) { event.allowed = !(/NO/).test(match[1]); @@ -264,7 +275,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'map' + tagType: 'map', + raw: newLine }; if (match[1]) { @@ -285,7 +297,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'stream-inf' + tagType: 'stream-inf', + raw: newLine }; if (match[1]) { event.attributes = parseAttributes(match[1]); @@ -316,7 +329,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'media' + tagType: 'media', + raw: newLine }; if (match[1]) { event.attributes = parseAttributes(match[1]); @@ -328,7 +342,8 @@ export default class ParseStream extends Stream { if (match) { this.trigger('data', { type: 'tag', - tagType: 'endlist' + tagType: 'endlist', + raw: newLine }); return; } @@ -336,7 +351,8 @@ export default class ParseStream extends Stream { if (match) { this.trigger('data', { type: 'tag', - tagType: 'discontinuity' + tagType: 'discontinuity', + raw: newLine }); return; } @@ -344,7 +360,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'program-date-time' + tagType: 'program-date-time', + raw: newLine }; if (match[1]) { event.dateTimeString = match[1]; @@ -357,7 +374,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'key' + tagType: 'key', + raw: newLine }; if (match[1]) { event.attributes = parseAttributes(match[1]); @@ -382,7 +400,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'start' + tagType: 'start', + raw: newLine }; if (match[1]) { event.attributes = parseAttributes(match[1]); @@ -397,7 +416,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'cue-out-cont' + tagType: 'cue-out-cont', + raw: newLine }; if (match[1]) { event.data = match[1]; @@ -411,7 +431,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'cue-out' + tagType: 'cue-out', + raw: newLine }; if (match[1]) { event.data = match[1]; @@ -425,7 +446,8 @@ export default class ParseStream extends Stream { if (match) { event = { type: 'tag', - tagType: 'cue-in' + tagType: 'cue-in', + raw: newLine }; if (match[1]) { event.data = match[1]; @@ -439,7 +461,8 @@ export default class ParseStream extends Stream { if (match && match[1]) { event = { type: 'tag', - tagType: 'skip' + tagType: 'skip', + raw: newLine }; event.attributes = parseAttributes(match[1]); @@ -459,7 +482,8 @@ export default class ParseStream extends Stream { if (match && match[1]) { event = { type: 'tag', - tagType: 'part' + tagType: 'part', + raw: newLine }; event.attributes = parseAttributes(match[1]); ['DURATION'].forEach(function(key) { @@ -485,7 +509,8 @@ export default class ParseStream extends Stream { if (match && match[1]) { event = { type: 'tag', - tagType: 'server-control' + tagType: 'server-control', + raw: newLine }; event.attributes = parseAttributes(match[1]); ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function(key) { @@ -507,7 +532,8 @@ export default class ParseStream extends Stream { if (match && match[1]) { event = { type: 'tag', - tagType: 'part-inf' + tagType: 'part-inf', + raw: newLine }; event.attributes = parseAttributes(match[1]); ['PART-TARGET'].forEach(function(key) { @@ -524,7 +550,8 @@ export default class ParseStream extends Stream { if (match && match[1]) { event = { type: 'tag', - tagType: 'preload-hint' + tagType: 'preload-hint', + raw: newLine }; event.attributes = parseAttributes(match[1]); ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function(key) { @@ -547,7 +574,8 @@ export default class ParseStream extends Stream { if (match && match[1]) { event = { type: 'tag', - tagType: 'rendition-report' + tagType: 'rendition-report', + raw: newLine }; event.attributes = parseAttributes(match[1]); ['LAST-MSN', 'LAST-PART'].forEach(function(key) { @@ -563,7 +591,8 @@ export default class ParseStream extends Stream { // unknown tag type this.trigger('data', { type: 'tag', - data: newLine.slice(4) + data: newLine.slice(4), + raw: newLine }); }); } diff --git a/src/parser.js b/src/parser.js index eebe9ba..3b51d8a 100644 --- a/src/parser.js +++ b/src/parser.js @@ -101,7 +101,7 @@ export default class Parser extends Stream { const self = this; /* eslint-enable consistent-this */ const uris = []; - let currentUri = {}; + let currentUri = { raw: [] }; // if specified, the active EXT-X-MAP definition let currentMap; // if specified, the active decryption key @@ -178,6 +178,7 @@ export default class Parser extends Stream { } }, byterange() { + currentUri.raw.push(entry.raw); const byterange = {}; if ('length' in entry) { @@ -208,6 +209,7 @@ export default class Parser extends Stream { this.manifest.endList = true; }, inf() { + currentUri.raw.push(entry.raw); if (!('mediaSequence' in this.manifest)) { this.manifest.mediaSequence = 0; this.trigger('info', { @@ -379,6 +381,7 @@ export default class Parser extends Stream { } }, 'stream-inf'() { + currentUri.raw.push(entry.raw); this.manifest.playlists = uris; this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; @@ -445,11 +448,13 @@ export default class Parser extends Stream { mediaGroup[entry.attributes.NAME] = rendition; }, discontinuity() { + currentUri.raw.push(entry.raw); currentTimeline += 1; currentUri.discontinuity = true; this.manifest.discontinuityStarts.push(uris.length); }, 'program-date-time'() { + currentUri.raw.push(entry.raw); if (typeof this.manifest.dateTimeString === 'undefined') { // PROGRAM-DATE-TIME is a media-segment tag, but for backwards // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag @@ -486,12 +491,15 @@ export default class Parser extends Stream { }; }, 'cue-out'() { + currentUri.raw.push(entry.raw); currentUri.cueOut = entry.data; }, 'cue-out-cont'() { + currentUri.raw.push(entry.raw); currentUri.cueOutCont = entry.data; }, 'cue-in'() { + currentUri.raw.push(entry.raw); currentUri.cueIn = entry.data; }, 'skip'() { @@ -504,6 +512,7 @@ export default class Parser extends Stream { ); }, 'part'() { + currentUri.raw.push(entry.raw); hasParts = true; // parts are always specifed before a segment const segmentIndex = this.manifest.segments.length; @@ -555,6 +564,7 @@ export default class Parser extends Stream { } }, 'preload-hint'() { + currentUri.raw.push(entry.raw); // parts are always specifed before a segment const segmentIndex = this.manifest.segments.length; const hint = camelCaseKeys(entry.attributes); @@ -635,6 +645,7 @@ export default class Parser extends Stream { })[entry.tagType] || noop).call(self); }, uri() { + currentUri.raw.push(entry.raw); currentUri.uri = entry.uri; uris.push(currentUri); @@ -659,7 +670,7 @@ export default class Parser extends Stream { lastPartByterangeEnd = 0; // prepare for the next URI - currentUri = {}; + currentUri = { raw: [] }; }, comment() { // comments are not important for playback @@ -667,6 +678,7 @@ export default class Parser extends Stream { custom() { // if this is segment-level data attach the output to the segment if (entry.segment) { + currentUri.raw.push(entry.raw); currentUri.custom = currentUri.custom || {}; currentUri.custom[entry.customType] = entry.data; // if this is manifest-level data attach to the top level manifest object diff --git a/test/fixtures/integration/absoluteUris.js b/test/fixtures/integration/absoluteUris.js index 370c8c1..d20ea8b 100644 --- a/test/fixtures/integration/absoluteUris.js +++ b/test/fixtures/integration/absoluteUris.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + 'http://example.com/00001.ts' + ], timeline: 0, uri: 'http://example.com/00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'https://example.com/00002.ts' + ], timeline: 0, uri: 'https://example.com/00002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '//example.com/00003.ts' + ], timeline: 0, uri: '//example.com/00003.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'http://example.com/00004.ts' + ], timeline: 0, uri: 'http://example.com/00004.ts' } diff --git a/test/fixtures/integration/allowCache.js b/test/fixtures/integration/allowCache.js index b034613..2d0ac67 100644 --- a/test/fixtures/integration/allowCache.js +++ b/test/fixtures/integration/allowCache.js @@ -9,6 +9,11 @@ module.exports = { offset: 0 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:522828@0', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -18,6 +23,11 @@ module.exports = { offset: 522828 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:587500@522828', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -27,6 +37,11 @@ module.exports = { offset: 1110328 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:713084@1110328', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -36,6 +51,11 @@ module.exports = { offset: 1823412 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:476580@1823412', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -45,6 +65,11 @@ module.exports = { offset: 2299992 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:535612@2299992', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -54,6 +79,11 @@ module.exports = { offset: 2835604 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:207176@2835604', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -63,6 +93,11 @@ module.exports = { offset: 3042780 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:455900@3042780', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -72,6 +107,11 @@ module.exports = { offset: 3498680 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:657248@3498680', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -81,6 +121,11 @@ module.exports = { offset: 4155928 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:571708@4155928', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -90,6 +135,11 @@ module.exports = { offset: 4727636 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:485040@4727636', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -99,6 +149,11 @@ module.exports = { offset: 5212676 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:709136@5212676', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -108,6 +163,11 @@ module.exports = { offset: 5921812 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:730004@5921812', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -117,6 +177,11 @@ module.exports = { offset: 6651816 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:456276@6651816', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -126,6 +191,11 @@ module.exports = { offset: 7108092 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:468684@7108092', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -135,6 +205,11 @@ module.exports = { offset: 7576776 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:444996@7576776', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -144,6 +219,11 @@ module.exports = { offset: 8021772 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:331444@8021772', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -153,6 +233,11 @@ module.exports = { offset: 8353216 }, duration: 1.4167, + raw: [ + '#EXTINF:1.4167,', + '#EXT-X-BYTERANGE:44556@8353216', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/allowCacheInvalid.js b/test/fixtures/integration/allowCacheInvalid.js index 0ecbdc1..f02fce7 100644 --- a/test/fixtures/integration/allowCacheInvalid.js +++ b/test/fixtures/integration/allowCacheInvalid.js @@ -9,6 +9,11 @@ module.exports = { offset: 0 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:522828@0', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/alternateAudio.js b/test/fixtures/integration/alternateAudio.js index 9ea9638..495ecd3 100644 --- a/test/fixtures/integration/alternateAudio.js +++ b/test/fixtures/integration/alternateAudio.js @@ -40,6 +40,10 @@ module.exports = { 'CODECS': 'avc1.42e00a,mp4a.40.2', 'AUDIO': 'audio' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS=\"avc1.42e00a,mp4a.40.2\",AUDIO=\"audio\"', + 'lo/prog_index.m3u8' + ], timeline: 0, uri: 'lo/prog_index.m3u8' }, { @@ -49,6 +53,10 @@ module.exports = { 'CODECS': 'avc1.42e01e,mp4a.40.2', 'AUDIO': 'audio' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS=\"avc1.42e01e,mp4a.40.2\",AUDIO=\"audio\"', + 'hi/prog_index.m3u8' + ], timeline: 0, uri: 'hi/prog_index.m3u8' }], diff --git a/test/fixtures/integration/alternateVideo.js b/test/fixtures/integration/alternateVideo.js index e786777..d95f79c 100644 --- a/test/fixtures/integration/alternateVideo.js +++ b/test/fixtures/integration/alternateVideo.js @@ -41,6 +41,10 @@ module.exports = { 'AUDIO': 'aac', 'VIDEO': '500kbs' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=754857,CODECS=\"mp4a.40.2,avc1.4d401e\",VIDEO=\"500kbs\",AUDIO=\"aac\"', + 'Angle1/500kbs/prog_index.m3u8' + ], timeline: 0, uri: 'Angle1/500kbs/prog_index.m3u8' }], diff --git a/test/fixtures/integration/brightcove.js b/test/fixtures/integration/brightcove.js index 67b155c..87900d2 100644 --- a/test/fixtures/integration/brightcove.js +++ b/test/fixtures/integration/brightcove.js @@ -10,6 +10,10 @@ module.exports = { height: 224 } }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=396x224', + 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001' + ], timeline: 0, uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001' }, @@ -18,6 +22,10 @@ module.exports = { 'PROGRAM-ID': 1, 'BANDWIDTH': 40000 }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=40000', + 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001' + ], timeline: 0, uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001' }, @@ -30,6 +38,10 @@ module.exports = { height: 224 } }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000,RESOLUTION=396x224', + 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001' + ], timeline: 0, uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001' }, @@ -42,6 +54,10 @@ module.exports = { height: 540 } }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540', + 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001' + ], timeline: 0, uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001' } diff --git a/test/fixtures/integration/byteRange.js b/test/fixtures/integration/byteRange.js index 6be4760..25869b3 100644 --- a/test/fixtures/integration/byteRange.js +++ b/test/fixtures/integration/byteRange.js @@ -5,6 +5,10 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -14,6 +18,11 @@ module.exports = { offset: 522828 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:587500@522828', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -23,6 +32,11 @@ module.exports = { offset: 1110328 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:713084', + 'hls_450k_video2.ts' + ], timeline: 0, uri: 'hls_450k_video2.ts' }, @@ -32,6 +46,11 @@ module.exports = { offset: 1823412 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:476580@1823412', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -41,6 +60,11 @@ module.exports = { offset: 2299992 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:535612@2299992', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -50,6 +74,11 @@ module.exports = { offset: 2835604 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:207176@2835604', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -59,6 +88,11 @@ module.exports = { offset: 3042780 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:455900@3042780', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -68,6 +102,11 @@ module.exports = { offset: 3498680 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:657248@3498680', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -77,6 +116,11 @@ module.exports = { offset: 4155928 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:571708@4155928', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -86,6 +130,11 @@ module.exports = { offset: 4727636 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:485040@4727636', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -95,6 +144,11 @@ module.exports = { offset: 5212676 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:709136@5212676', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -104,6 +158,11 @@ module.exports = { offset: 5921812 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:730004@5921812', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -113,6 +172,11 @@ module.exports = { offset: 6651816 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:456276@6651816', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -122,6 +186,11 @@ module.exports = { offset: 7108092 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:468684@7108092', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -131,6 +200,11 @@ module.exports = { offset: 7576776 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:444996@7576776', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -140,6 +214,11 @@ module.exports = { offset: 8021772 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:331444@8021772', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -149,6 +228,11 @@ module.exports = { offset: 8353216 }, duration: 1.4167, + raw: [ + '#EXTINF:1.4167,', + '#EXT-X-BYTERANGE:44556@8353216', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/dateTime.js b/test/fixtures/integration/dateTime.js index 698d5a1..75c5740 100644 --- a/test/fixtures/integration/dateTime.js +++ b/test/fixtures/integration/dateTime.js @@ -7,6 +7,11 @@ module.exports = { dateTimeString: '2016-06-22T09:20:16.166-04:00', dateTimeObject: new Date('2016-06-22T09:20:16.166-04:00'), duration: 10, + raw: [ + '#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:16.166-04:00', + '#EXTINF:10', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -14,6 +19,11 @@ module.exports = { dateTimeString: '2016-06-22T09:20:26.166-04:00', dateTimeObject: new Date('2016-06-22T09:20:26.166-04:00'), duration: 10, + raw: [ + '#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:26.166-04:00', + '#EXTINF:10', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/diff-init-key.js b/test/fixtures/integration/diff-init-key.js index d407939..fad2e2b 100644 --- a/test/fixtures/integration/diff-init-key.js +++ b/test/fixtures/integration/diff-init-key.js @@ -17,6 +17,10 @@ module.exports = { }, uri: 'http://media.example.com/init52.mp4' }, + raw: [ + '#EXTINF:2.833,', + 'http://media.example.com/fileSequence52-A.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence52-A.m4s' }, @@ -33,6 +37,10 @@ module.exports = { }, uri: 'http://media.example.com/init52.mp4' }, + raw: [ + '#EXTINF:15.0,', + 'http://media.example.com/fileSequence52-B.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence52-B.m4s' }, @@ -49,6 +57,10 @@ module.exports = { }, uri: 'http://media.example.com/init52.mp4' }, + raw: [ + '#EXTINF:13.333,', + 'http://media.example.com/fileSequence52-C.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence52-C.m4s' }, @@ -65,6 +77,10 @@ module.exports = { }, uri: 'http://media.example.com/init53-A.mp4' }, + raw: [ + '#EXTINF:15.0,', + 'http://media.example.com/fileSequence53-A.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence53-A.m4s' }, @@ -83,6 +99,10 @@ module.exports = { }, uri: 'http://media.example.com/init53-B.mp4' }, + raw: [ + '#EXTINF:14.0,', + 'http://media.example.com/fileSequence53-B.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence53-B.m4s' }, @@ -95,6 +115,10 @@ module.exports = { map: { uri: 'http://media.example.com/init54-A.mp4' }, + raw: [ + '#EXTINF:12.0,', + 'http://media.example.com/fileSequence54-A.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence54-A.m4s' }, @@ -107,6 +131,10 @@ module.exports = { map: { uri: 'http://media.example.com/init54-A.mp4' }, + raw: [ + '#EXTINF:13.0,', + 'http://media.example.com/fileSequence54-B.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence54-B.m4s' }, @@ -119,6 +147,10 @@ module.exports = { }, uri: 'http://media.example.com/init54-B.mp4' }, + raw: [ + '#EXTINF:10.0,', + 'http://media.example.com/fileSequence54-A.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence54-A.m4s' }, @@ -131,6 +163,10 @@ module.exports = { }, uri: 'http://media.example.com/init54-B.mp4' }, + raw: [ + '#EXTINF:11.0,', + 'http://media.example.com/fileSequence54-B.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence54-B.m4s' }, @@ -147,6 +183,10 @@ module.exports = { }, uri: 'http://media.example.com/init54-D.mp4' }, + raw: [ + '#EXTINF:4.0,', + 'http://media.example.com/fileSequence54-A.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence54-A.m4s' }, @@ -155,6 +195,10 @@ module.exports = { map: { uri: 'http://media.example.com/init54-E.mp4' }, + raw: [ + '#EXTINF:12.0,', + 'http://media.example.com/fileSequence54-A.m4s' + ], timeline: 0, uri: 'http://media.example.com/fileSequence54-A.m4s' } diff --git a/test/fixtures/integration/disallowCache.js b/test/fixtures/integration/disallowCache.js index c5433df..e486775 100644 --- a/test/fixtures/integration/disallowCache.js +++ b/test/fixtures/integration/disallowCache.js @@ -9,6 +9,11 @@ module.exports = { offset: 0 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:522828@0', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/disc-sequence.js b/test/fixtures/integration/disc-sequence.js index 8ce90fa..b56245a 100644 --- a/test/fixtures/integration/disc-sequence.js +++ b/test/fixtures/integration/disc-sequence.js @@ -5,22 +5,39 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,0', + '001.ts' + ], timeline: 3, uri: '001.ts' }, { duration: 19, + raw: [ + '#EXTINF:19,0', + '002.ts' + ], timeline: 3, uri: '002.ts' }, { discontinuity: true, duration: 10, + raw: [ + '#EXT-X-DISCONTINUITY', + '#EXTINF:10,0', + '003.ts' + ], timeline: 4, uri: '003.ts' }, { duration: 11, + raw: [ + '#EXTINF:11,0', + '004.ts' + ], timeline: 4, uri: '004.ts' } diff --git a/test/fixtures/integration/discontinuity.js b/test/fixtures/integration/discontinuity.js index 7cdd8df..e0097e5 100644 --- a/test/fixtures/integration/discontinuity.js +++ b/test/fixtures/integration/discontinuity.js @@ -5,49 +5,88 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,0', + '001.ts' + ], timeline: 0, uri: '001.ts' }, { duration: 19, + raw: [ + '#EXTINF:19,0', + '002.ts' + ], timeline: 0, uri: '002.ts' }, { discontinuity: true, duration: 10, + raw: [ + '#EXT-X-DISCONTINUITY', + '#EXTINF:10,0', + '003.ts' + ], timeline: 1, uri: '003.ts' }, { duration: 11, + raw: [ + '#EXTINF:11,0', + '004.ts' + ], timeline: 1, uri: '004.ts' }, { discontinuity: true, duration: 10, + raw: [ + '#EXT-X-DISCONTINUITY', + '#EXTINF:10,0', + '005.ts' + ], timeline: 2, uri: '005.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,0', + '006.ts' + ], timeline: 2, uri: '006.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,0', + '007.ts' + ], timeline: 2, uri: '007.ts' }, { discontinuity: true, duration: 10, + raw: [ + '#EXT-X-DISCONTINUITY', + '#EXTINF:10,0', + '008.ts' + ], timeline: 3, uri: '008.ts' }, { duration: 16, + raw: [ + '#EXTINF:16,0', + '009.ts' + ], timeline: 3, uri: '009.ts' } diff --git a/test/fixtures/integration/domainUris.js b/test/fixtures/integration/domainUris.js index 06b3524..ae2e3e1 100644 --- a/test/fixtures/integration/domainUris.js +++ b/test/fixtures/integration/domainUris.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + '/00001.ts' + ], timeline: 0, uri: '/00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/subdir/00002.ts' + ], timeline: 0, uri: '/subdir/00002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/00003.ts' + ], timeline: 0, uri: '/00003.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/00004.ts' + ], timeline: 0, uri: '/00004.ts' } diff --git a/test/fixtures/integration/emptyAllowCache.js b/test/fixtures/integration/emptyAllowCache.js index 0ecbdc1..f02fce7 100644 --- a/test/fixtures/integration/emptyAllowCache.js +++ b/test/fixtures/integration/emptyAllowCache.js @@ -9,6 +9,11 @@ module.exports = { offset: 0 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:522828@0', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/emptyMediaSequence.js b/test/fixtures/integration/emptyMediaSequence.js index d927c98..6354ce2 100644 --- a/test/fixtures/integration/emptyMediaSequence.js +++ b/test/fixtures/integration/emptyMediaSequence.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' }, { duration: 6.08, + raw: [ + '#EXTINF:6.080,{}', + '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' }, { duration: 6.6, + raw: [ + '#EXTINF:6.600,{}', + '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' }, { duration: 5, + raw: [ + '#EXTINF:5.000,{}', + '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' } diff --git a/test/fixtures/integration/emptyPlaylistType.js b/test/fixtures/integration/emptyPlaylistType.js index ebed6e8..b8b14bb 100644 --- a/test/fixtures/integration/emptyPlaylistType.js +++ b/test/fixtures/integration/emptyPlaylistType.js @@ -4,31 +4,55 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' }, { duration: 8, + raw: [ + '#EXTINF:8,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' } diff --git a/test/fixtures/integration/emptyTargetDuration.js b/test/fixtures/integration/emptyTargetDuration.js index 67b155c..87900d2 100644 --- a/test/fixtures/integration/emptyTargetDuration.js +++ b/test/fixtures/integration/emptyTargetDuration.js @@ -10,6 +10,10 @@ module.exports = { height: 224 } }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=396x224', + 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001' + ], timeline: 0, uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001' }, @@ -18,6 +22,10 @@ module.exports = { 'PROGRAM-ID': 1, 'BANDWIDTH': 40000 }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=40000', + 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001' + ], timeline: 0, uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001' }, @@ -30,6 +38,10 @@ module.exports = { height: 224 } }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000,RESOLUTION=396x224', + 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001' + ], timeline: 0, uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001' }, @@ -42,6 +54,10 @@ module.exports = { height: 540 } }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540', + 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001' + ], timeline: 0, uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001' } diff --git a/test/fixtures/integration/encrypted.js b/test/fixtures/integration/encrypted.js index e0ed64c..655454d 100644 --- a/test/fixtures/integration/encrypted.js +++ b/test/fixtures/integration/encrypted.js @@ -6,6 +6,10 @@ module.exports = { segments: [ { duration: 2.833, + raw: [ + '#EXTINF:2.833,', + 'http://media.example.com/fileSequence52-A.ts' + ], timeline: 0, key: { method: 'AES-128', @@ -15,6 +19,10 @@ module.exports = { }, { duration: 15, + raw: [ + '#EXTINF:15.0,', + 'http://media.example.com/fileSequence52-B.ts' + ], timeline: 0, key: { method: 'AES-128', @@ -24,6 +32,10 @@ module.exports = { }, { duration: 13.333, + raw: [ + '#EXTINF:13.333,', + 'http://media.example.com/fileSequence52-C.ts' + ], timeline: 0, key: { method: 'AES-128', @@ -33,6 +45,10 @@ module.exports = { }, { duration: 15, + raw: [ + '#EXTINF:15.0,', + 'http://media.example.com/fileSequence53-A.ts' + ], timeline: 0, key: { method: 'AES-128', @@ -42,6 +58,10 @@ module.exports = { }, { duration: 14, + raw: [ + '#EXTINF:14.0,', + 'http://media.example.com/fileSequence53-B.ts' + ], timeline: 0, key: { method: 'AES-128', @@ -52,6 +72,10 @@ module.exports = { }, { duration: 15, + raw: [ + '#EXTINF:15.0,', + 'http://media.example.com/fileSequence53-B.ts' + ], timeline: 0, uri: 'http://media.example.com/fileSequence53-B.ts' } diff --git a/test/fixtures/integration/event.js b/test/fixtures/integration/event.js index 57be0d5..5c1e4b8 100644 --- a/test/fixtures/integration/event.js +++ b/test/fixtures/integration/event.js @@ -5,31 +5,55 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' }, { duration: 8, + raw: [ + '#EXTINF:8,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' } diff --git a/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js b/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js index bb2eb8b..505a8aa 100644 --- a/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js +++ b/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js @@ -4,6 +4,10 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' } diff --git a/test/fixtures/integration/extinf.js b/test/fixtures/integration/extinf.js index efa8418..1d5a3b7 100644 --- a/test/fixtures/integration/extinf.js +++ b/test/fixtures/integration/extinf.js @@ -9,6 +9,11 @@ module.exports = { offset: 0 }, duration: 10, + raw: [ + '#EXTINF:10', + '#EXT-X-BYTERANGE:522828@0', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -18,6 +23,11 @@ module.exports = { offset: 522828 }, duration: 10, + raw: [ + '#EXTINF:;asljasdfii11)))00,', + '#EXT-X-BYTERANGE:587500@522828', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -27,6 +37,11 @@ module.exports = { offset: 1110328 }, duration: 5, + raw: [ + '#EXTINF:5,', + '#EXT-X-BYTERANGE:713084@1110328', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -36,6 +51,11 @@ module.exports = { offset: 1823412 }, duration: 9.7, + raw: [ + '#EXTINF:9.7,', + '#EXT-X-BYTERANGE:476580@1823412', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -45,6 +65,11 @@ module.exports = { offset: 2299992 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:535612@2299992', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -54,6 +79,11 @@ module.exports = { offset: 2835604 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:207176@2835604', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -63,6 +93,11 @@ module.exports = { offset: 3042780 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:455900@3042780', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -72,6 +107,11 @@ module.exports = { offset: 3498680 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:657248@3498680', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -81,6 +121,11 @@ module.exports = { offset: 4155928 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:571708@4155928', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -90,6 +135,11 @@ module.exports = { offset: 4727636 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:485040@4727636', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -99,6 +149,11 @@ module.exports = { offset: 5212676 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:709136@5212676', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -108,6 +163,11 @@ module.exports = { offset: 5921812 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:730004@5921812', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -117,6 +177,11 @@ module.exports = { offset: 6651816 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:456276@6651816', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -126,6 +191,11 @@ module.exports = { offset: 7108092 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:468684@7108092', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -135,6 +205,11 @@ module.exports = { offset: 7576776 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:444996@7576776', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -144,6 +219,12 @@ module.exports = { offset: 8021772 }, duration: 10, + raw: [ + '#EXTINF:22,', + '#EXTINF:10,', + '#EXT-X-BYTERANGE:331444@8021772', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -153,6 +234,10 @@ module.exports = { offset: 8353216 }, duration: 10, + raw: [ + '#EXT-X-BYTERANGE:44556@8353216', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/fmp4.js b/test/fixtures/integration/fmp4.js index 5618ab8..e2d8e87 100644 --- a/test/fixtures/integration/fmp4.js +++ b/test/fixtures/integration/fmp4.js @@ -12,6 +12,11 @@ module.exports = { offset: 720 }, duration: 6.006, + raw: [ + '#EXTINF:6.00600,', + '#EXT-X-BYTERANGE:5666510@720', + 'main.mp4' + ], timeline: 0, uri: 'main.mp4', map: { @@ -28,6 +33,11 @@ module.exports = { offset: 5667230 }, duration: 6.006, + raw: [ + '#EXTINF:6.00600,', + '#EXT-X-BYTERANGE:5861577@5667230', + 'main.mp4' + ], timeline: 0, uri: 'main.mp4', map: { diff --git a/test/fixtures/integration/invalidAllowCache.js b/test/fixtures/integration/invalidAllowCache.js index 0ecbdc1..f02fce7 100644 --- a/test/fixtures/integration/invalidAllowCache.js +++ b/test/fixtures/integration/invalidAllowCache.js @@ -9,6 +9,11 @@ module.exports = { offset: 0 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:522828@0', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/invalidMediaSequence.js b/test/fixtures/integration/invalidMediaSequence.js index d927c98..6354ce2 100644 --- a/test/fixtures/integration/invalidMediaSequence.js +++ b/test/fixtures/integration/invalidMediaSequence.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' }, { duration: 6.08, + raw: [ + '#EXTINF:6.080,{}', + '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' }, { duration: 6.6, + raw: [ + '#EXTINF:6.600,{}', + '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' }, { duration: 5, + raw: [ + '#EXTINF:5.000,{}', + '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' } diff --git a/test/fixtures/integration/invalidPlaylistType.js b/test/fixtures/integration/invalidPlaylistType.js index ebed6e8..b8b14bb 100644 --- a/test/fixtures/integration/invalidPlaylistType.js +++ b/test/fixtures/integration/invalidPlaylistType.js @@ -4,31 +4,55 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' }, { duration: 8, + raw: [ + '#EXTINF:8,', + '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' } diff --git a/test/fixtures/integration/invalidTargetDuration.js b/test/fixtures/integration/invalidTargetDuration.js index 2d5b5ff..71552c6 100644 --- a/test/fixtures/integration/invalidTargetDuration.js +++ b/test/fixtures/integration/invalidTargetDuration.js @@ -9,6 +9,11 @@ module.exports = { offset: 0 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:522828@0', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -18,6 +23,11 @@ module.exports = { offset: 522828 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:587500@522828', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -27,6 +37,11 @@ module.exports = { offset: 1110328 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:713084@1110328', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -36,6 +51,11 @@ module.exports = { offset: 1823412 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:476580@1823412', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -45,6 +65,11 @@ module.exports = { offset: 2299992 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:535612@2299992', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -54,6 +79,11 @@ module.exports = { offset: 2835604 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:207176@2835604', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -63,6 +93,11 @@ module.exports = { offset: 3042780 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:455900@3042780', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -72,6 +107,11 @@ module.exports = { offset: 3498680 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:657248@3498680', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -81,6 +121,11 @@ module.exports = { offset: 4155928 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:571708@4155928', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -90,6 +135,11 @@ module.exports = { offset: 4727636 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:485040@4727636', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -99,6 +149,11 @@ module.exports = { offset: 5212676 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:709136@5212676', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -108,6 +163,11 @@ module.exports = { offset: 5921812 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:730004@5921812', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -117,6 +177,11 @@ module.exports = { offset: 6651816 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:456276@6651816', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -126,6 +191,11 @@ module.exports = { offset: 7108092 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:468684@7108092', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -135,6 +205,11 @@ module.exports = { offset: 7576776 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:444996@7576776', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -144,6 +219,11 @@ module.exports = { offset: 8021772 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:331444@8021772', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -153,6 +233,11 @@ module.exports = { offset: 8353216 }, duration: 1.4167, + raw: [ + '#EXTINF:1.4167,', + '#EXT-X-BYTERANGE:44556@8353216', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/liveMissingSegmentDuration.js b/test/fixtures/integration/liveMissingSegmentDuration.js index 3dafc55..da3def1 100644 --- a/test/fixtures/integration/liveMissingSegmentDuration.js +++ b/test/fixtures/integration/liveMissingSegmentDuration.js @@ -5,16 +5,26 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' }, { duration: 8, + raw: [ + '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' }, { duration: 8, + raw: [ + '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' } diff --git a/test/fixtures/integration/liveStart30sBefore.js b/test/fixtures/integration/liveStart30sBefore.js index de41765..ccd2953 100644 --- a/test/fixtures/integration/liveStart30sBefore.js +++ b/test/fixtures/integration/liveStart30sBefore.js @@ -4,46 +4,82 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,0', + '001.ts' + ], timeline: 0, uri: '001.ts' }, { duration: 19, + raw: [ + '#EXTINF:19,0', + '002.ts' + ], timeline: 0, uri: '002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,0', + '003.ts' + ], timeline: 0, uri: '003.ts' }, { duration: 11, + raw: [ + '#EXTINF:11,0', + '004.ts' + ], timeline: 0, uri: '004.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,0', + '005.ts' + ], timeline: 0, uri: '005.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,0', + '006.ts' + ], timeline: 0, uri: '006.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,0', + '007.ts' + ], timeline: 0, uri: '007.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,0', + '008.ts' + ], timeline: 0, uri: '008.ts' }, { duration: 16, + raw: [ + '#EXTINF:16,0', + '009.ts' + ], timeline: 0, uri: '009.ts' } diff --git a/test/fixtures/integration/llhls-byte-range.js b/test/fixtures/integration/llhls-byte-range.js index 52e6e02..5610afd 100644 --- a/test/fixtures/integration/llhls-byte-range.js +++ b/test/fixtures/integration/llhls-byte-range.js @@ -31,6 +31,11 @@ module.exports = { } } ], + raw: [ + '#EXT-X-PRELOAD-HINT:TYPE=PART,URI=\"filePart273.1.mp4\",BYTERANGE-LENGTH=2000', + '#EXT-X-PRELOAD-HINT:TYPE=MAP,URI=\"file-init.mp4\",BYTERANGE-LENGTH=5000,BYTERANGE-START=8355216', + '#EXT-X-PRELOAD-HINT:TYPE=FOO,URI=\"foo.mp4\",BYTERANGE-LENGTH=5000' + ], timeline: 0 }, segments: [ @@ -40,6 +45,11 @@ module.exports = { offset: 0 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:587500@', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -49,6 +59,11 @@ module.exports = { offset: 522828 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:587500@522828', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -58,6 +73,11 @@ module.exports = { offset: 1110328 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:713084', + 'hls_450k_video2.ts' + ], timeline: 0, uri: 'hls_450k_video2.ts' }, @@ -67,6 +87,11 @@ module.exports = { offset: 1823412 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:476580@1823412', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -76,6 +101,11 @@ module.exports = { offset: 2299992 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:535612@2299992', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -85,6 +115,11 @@ module.exports = { offset: 2835604 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:207176@2835604', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -94,6 +129,11 @@ module.exports = { offset: 3042780 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:455900@3042780', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -103,6 +143,11 @@ module.exports = { offset: 3498680 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:657248@3498680', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -112,6 +157,11 @@ module.exports = { offset: 4155928 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:571708@4155928', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -121,6 +171,11 @@ module.exports = { offset: 4727636 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:485040@4727636', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -130,6 +185,11 @@ module.exports = { offset: 5212676 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:709136@5212676', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -139,6 +199,11 @@ module.exports = { offset: 5921812 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:730004@5921812', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -148,6 +213,11 @@ module.exports = { offset: 6651816 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:456276@6651816', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -157,6 +227,11 @@ module.exports = { offset: 7108092 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:468684@7108092', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -166,6 +241,11 @@ module.exports = { offset: 7576776 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:444996@7576776', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -209,6 +289,15 @@ module.exports = { } } ], + raw: [ + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.part.ts\",BYTERANGE=45553', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.part.ts\",BYTERANGE=28823@7622329', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.part.ts\",BYTERANGE=22444', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.part.ts\",BYTERANGE=22444', + '#EXTINF:10,', + '#EXT-X-BYTERANGE:331444@8021772', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -244,6 +333,14 @@ module.exports = { } } ], + raw: [ + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=45553@8021772', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=28823', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=22444', + '#EXTINF:1.4167,', + '#EXT-X-BYTERANGE:44556@8353216', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/llhls-delta-byte-range.js b/test/fixtures/integration/llhls-delta-byte-range.js index 908f4ca..8d47d76 100644 --- a/test/fixtures/integration/llhls-delta-byte-range.js +++ b/test/fixtures/integration/llhls-delta-byte-range.js @@ -41,6 +41,12 @@ module.exports = { } } ], + raw: [ + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=22444', + '#EXT-X-PRELOAD-HINT:TYPE=PART,URI=\"filePart273.1.mp4\",BYTERANGE-LENGTH=2000', + '#EXT-X-PRELOAD-HINT:TYPE=MAP,URI=\"file-init.mp4\",BYTERANGE-LENGTH=5000,BYTERANGE-START=8377660', + '#EXT-X-PRELOAD-HINT:TYPE=FOO,URI=\"foo.mp4\",BYTERANGE-LENGTH=5000' + ], timeline: 0 }, segments: [ @@ -50,6 +56,12 @@ module.exports = { offset: 7108092 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXTINF:10,', + '#EXT-X-BYTERANGE:468684@7108092', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -59,6 +71,11 @@ module.exports = { offset: 7576776 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:444996@7576776', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -102,6 +119,15 @@ module.exports = { } } ], + raw: [ + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=45553', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=28823@7622329', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=22444', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=22444', + '#EXTINF:10,', + '#EXT-X-BYTERANGE:331444@8021772', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -137,6 +163,14 @@ module.exports = { } } ], + raw: [ + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=45553@8021772', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=28823', + '#EXT-X-PART:DURATION=0.33334,URI=\"hls_450k_video.ts\",BYTERANGE=22444', + '#EXTINF:1.4167,', + '#EXT-X-BYTERANGE:44556@8353216', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/llhls.js b/test/fixtures/integration/llhls.js index 5358830..56e5c44 100644 --- a/test/fixtures/integration/llhls.js +++ b/test/fixtures/integration/llhls.js @@ -26,6 +26,13 @@ module.exports = { {type: 'PART', uri: 'filePart273.3.mp4'}, {type: 'MAP', uri: 'file-init.mp4'} ], + raw: [ + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart273.0.mp4\",INDEPENDENT=YES', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart273.1.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart273.2.mp4\"', + '#EXT-X-PRELOAD-HINT:TYPE=PART,URI=\"filePart273.3.mp4\"', + '#EXT-X-PRELOAD-HINT:TYPE=MAP,URI=\"file-init.mp4\"' + ], timeline: 0 }, renditionReports: [ @@ -44,6 +51,11 @@ module.exports = { map: { uri: 'init.mp4' }, + raw: [ + '#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:13:36.106Z', + '#EXTINF:4.00008,', + 'fileSequence266.mp4' + ], timeline: 0, uri: 'fileSequence266.mp4' }, @@ -52,6 +64,10 @@ module.exports = { map: { uri: 'init.mp4' }, + raw: [ + '#EXTINF:4.00008,', + 'fileSequence267.mp4' + ], timeline: 0, uri: 'fileSequence267.mp4' }, @@ -60,6 +76,10 @@ module.exports = { map: { uri: 'init.mp4' }, + raw: [ + '#EXTINF:4.00008,', + 'fileSequence268.mp4' + ], timeline: 0, uri: 'fileSequence268.mp4' }, @@ -68,6 +88,10 @@ module.exports = { map: { uri: 'init.mp4' }, + raw: [ + '#EXTINF:4.00008,', + 'fileSequence269.mp4' + ], timeline: 0, uri: 'fileSequence269.mp4' }, @@ -76,6 +100,10 @@ module.exports = { map: { uri: 'init.mp4' }, + raw: [ + '#EXTINF:4.00008,', + 'fileSequence270.mp4' + ], timeline: 0, uri: 'fileSequence270.mp4' }, @@ -84,6 +112,22 @@ module.exports = { map: { uri: 'init.mp4' }, + raw: [ + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.0.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.1.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.2.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.3.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.4.mp4\",INDEPENDENT=YES', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.5.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.6.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.7.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.8.mp4\",INDEPENDENT=YES', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.9.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.10.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.11.mp4\"', + '#EXTINF:4.00008,', + 'fileSequence271.mp4' + ], timeline: 0, uri: 'fileSequence271.mp4', parts: [ @@ -146,6 +190,23 @@ module.exports = { map: { uri: 'init.mp4' }, + raw: [ + '#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:14:00.106Z', + '#EXT-X-PART:GAP=YES,DURATION=0.33334,URI=\"filePart272.a.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.b.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.c.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.d.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.e.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.f.mp4\",INDEPENDENT=YES', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.g.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.h.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.i.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.j.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.k.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.l.mp4\"', + '#EXTINF:4.00008,', + 'fileSequence272.mp4' + ], timeline: 0, uri: 'fileSequence272.mp4', parts: [ diff --git a/test/fixtures/integration/llhlsDelta.js b/test/fixtures/integration/llhlsDelta.js index 089b723..701e107 100644 --- a/test/fixtures/integration/llhlsDelta.js +++ b/test/fixtures/integration/llhlsDelta.js @@ -6,6 +6,14 @@ module.exports = { discontinuityStarts: [], mediaSequence: 266, preloadSegment: { + raw: [ + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart273.0.mp4\",INDEPENDENT=YES', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart273.1.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart273.2.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart273.3.mp4\"', + '#EXT-X-PRELOAD-HINT:TYPE=PART,URI=\"filePart273.4.mp4\"', + '#EXT-X-PRELOAD-HINT:TYPE=MAP,URI=\"file-init.mp4\"' + ], timeline: 0, preloadHints: [ {type: 'PART', uri: 'filePart273.4.mp4'}, @@ -42,16 +50,40 @@ module.exports = { segments: [ { duration: 4.00008, + raw: [ + '#EXTINF:4.00008,', + 'fileSequence269.mp4' + ], timeline: 0, uri: 'fileSequence269.mp4' }, { duration: 4.00008, + raw: [ + '#EXTINF:4.00008,', + 'fileSequence270.mp4' + ], timeline: 0, uri: 'fileSequence270.mp4' }, { duration: 4.00008, + raw: [ + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.0.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.1.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.2.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.3.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.4.mp4\",INDEPENDENT=YES', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.5.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.6.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.7.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.8.mp4\",INDEPENDENT=YES', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.9.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.10.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart271.11.mp4\"', + '#EXTINF:4.00008,', + 'fileSequence271.mp4' + ], timeline: 0, uri: 'fileSequence271.mp4', parts: [ @@ -111,6 +143,23 @@ module.exports = { dateTimeObject: new Date('2019-02-14T02:14:00.106Z'), dateTimeString: '2019-02-14T02:14:00.106Z', duration: 4.00008, + raw: [ + '#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:14:00.106Z', + '#EXT-X-PART:GAP=YES,DURATION=0.33334,URI=\"filePart272.a.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.b.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.c.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.d.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.e.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.f.mp4\",INDEPENDENT=YES', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.g.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.h.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.i.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.j.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.k.mp4\"', + '#EXT-X-PART:DURATION=0.33334,URI=\"filePart272.l.mp4\"', + '#EXTINF:4.00008,', + 'fileSequence272.mp4' + ], timeline: 0, uri: 'fileSequence272.mp4', parts: [ diff --git a/test/fixtures/integration/manifestExtTTargetdurationNegative.js b/test/fixtures/integration/manifestExtTTargetdurationNegative.js index cfdf211..7c84b2f 100644 --- a/test/fixtures/integration/manifestExtTTargetdurationNegative.js +++ b/test/fixtures/integration/manifestExtTTargetdurationNegative.js @@ -4,6 +4,10 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/gogo/00001.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/gogo/00001.ts' } diff --git a/test/fixtures/integration/manifestExtXEndlistEarly.js b/test/fixtures/integration/manifestExtXEndlistEarly.js index 69b5bc6..7c768c9 100644 --- a/test/fixtures/integration/manifestExtXEndlistEarly.js +++ b/test/fixtures/integration/manifestExtXEndlistEarly.js @@ -4,26 +4,46 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/gogo/00001.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/gogo/00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/gogo/00002.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/gogo/00002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/gogo/00003.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/gogo/00003.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/gogo/00004.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/gogo/00004.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/gogo/00005.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/gogo/00005.ts' } diff --git a/test/fixtures/integration/manifestNoExtM3u.js b/test/fixtures/integration/manifestNoExtM3u.js index d041da0..2327de7 100644 --- a/test/fixtures/integration/manifestNoExtM3u.js +++ b/test/fixtures/integration/manifestNoExtM3u.js @@ -4,6 +4,10 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + '/test/ts-files/zencoder/gogo/00001.ts' + ], timeline: 0, uri: '/test/ts-files/zencoder/gogo/00001.ts' } diff --git a/test/fixtures/integration/master-fmp4.js b/test/fixtures/integration/master-fmp4.js index 1c45e52..16ced11 100644 --- a/test/fixtures/integration/master-fmp4.js +++ b/test/fixtures/integration/master-fmp4.js @@ -65,6 +65,10 @@ module.exports = { 'AUDIO': 'aud1', 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2165224,BANDWIDTH=2215219,CODECS=\"avc1.640020,mp4a.40.2\",RESOLUTION=960x540,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud1\",SUBTITLES=\"sub1\"', + 'v4/prog_index.m3u8' + ], timeline: 0, uri: 'v4/prog_index.m3u8' }, @@ -83,6 +87,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=7962844,BANDWIDTH=7976430,CODECS=\"avc1.64002a,mp4a.40.2\",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud1\",SUBTITLES=\"sub1\"', + 'v8/prog_index.m3u8' + ], timeline: 0, uri: 'v8/prog_index.m3u8' }, @@ -100,6 +108,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6165024,BANDWIDTH=6181885,CODECS=\"avc1.64002a,mp4a.40.2\",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud1\",SUBTITLES=\"sub1\"', + 'v7/prog_index.m3u8' + ], timeline: 0, uri: 'v7/prog_index.m3u8' }, @@ -117,6 +129,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4664459,BANDWIDTH=4682666,CODECS=\"avc1.64002a,mp4a.40.2\",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud1\",SUBTITLES=\"sub1\"', + 'v6/prog_index.m3u8' + ], timeline: 0, uri: 'v6/prog_index.m3u8' }, @@ -134,6 +150,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3164759,BANDWIDTH=3170746,CODECS=\"avc1.640020,mp4a.40.2\",RESOLUTION=1280x720,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud1\",SUBTITLES=\"sub1\"', + 'v5/prog_index.m3u8' + ], timeline: 0, uri: 'v5/prog_index.m3u8' }, @@ -151,6 +171,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1262552,BANDWIDTH=1276223,CODECS=\"avc1.64001e,mp4a.40.2\",RESOLUTION=768x432,FRAME-RATE=29.970,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud1\",SUBTITLES=\"sub1\"', + 'v3/prog_index.m3u8' + ], timeline: 0, uri: 'v3/prog_index.m3u8' }, @@ -168,6 +192,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=893243,BANDWIDTH=904744,CODECS=\"avc1.64001e,mp4a.40.2\",RESOLUTION=640x360,FRAME-RATE=29.970,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud1\",SUBTITLES=\"sub1\"', + 'v2/prog_index.m3u8' + ], timeline: 0, uri: 'v2/prog_index.m3u8' }, @@ -185,6 +213,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=527673,BANDWIDTH=538201,CODECS=\"avc1.640015,mp4a.40.2\",RESOLUTION=480x270,FRAME-RATE=29.970,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud1\",SUBTITLES=\"sub1\"', + 'v1/prog_index.m3u8' + ], timeline: 0, uri: 'v1/prog_index.m3u8' }, @@ -202,6 +234,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2390334,BANDWIDTH=2440329,CODECS=\"avc1.640020,ac-3\",RESOLUTION=960x540,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud2\",SUBTITLES=\"sub1\"', + 'v4/prog_index.m3u8' + ], timeline: 0, uri: 'v4/prog_index.m3u8' }, @@ -219,6 +255,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=8187954,BANDWIDTH=8201540,CODECS=\"avc1.64002a,ac-3\",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud2\",SUBTITLES=\"sub1\"', + 'v8/prog_index.m3u8' + ], timeline: 0, uri: 'v8/prog_index.m3u8' }, @@ -236,6 +276,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6390134,BANDWIDTH=6406995,CODECS=\"avc1.64002a,ac-3\",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud2\",SUBTITLES=\"sub1\"', + 'v7/prog_index.m3u8' + ], timeline: 0, uri: 'v7/prog_index.m3u8' }, @@ -253,6 +297,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4889569,BANDWIDTH=4907776,CODECS=\"avc1.64002a,ac-3\",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud2\",SUBTITLES=\"sub1\"', + 'v6/prog_index.m3u8' + ], timeline: 0, uri: 'v6/prog_index.m3u8' }, @@ -270,6 +318,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3389869,BANDWIDTH=3395856,CODECS=\"avc1.640020,ac-3\",RESOLUTION=1280x720,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud2\",SUBTITLES=\"sub1\"', + 'v5/prog_index.m3u8' + ], timeline: 0, uri: 'v5/prog_index.m3u8' }, @@ -287,6 +339,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1487662,BANDWIDTH=1501333,CODECS=\"avc1.64001e,ac-3\",RESOLUTION=768x432,FRAME-RATE=29.970,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud2\",SUBTITLES=\"sub1\"', + 'v3/prog_index.m3u8' + ], timeline: 0, uri: 'v3/prog_index.m3u8' }, @@ -304,6 +360,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1118353,BANDWIDTH=1129854,CODECS=\"avc1.64001e,ac-3\",RESOLUTION=640x360,FRAME-RATE=29.970,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud2\",SUBTITLES=\"sub1\"', + 'v2/prog_index.m3u8' + ], timeline: 0, uri: 'v2/prog_index.m3u8' }, @@ -321,6 +381,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=752783,BANDWIDTH=763311,CODECS=\"avc1.640015,ac-3\",RESOLUTION=480x270,FRAME-RATE=29.970,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud2\",SUBTITLES=\"sub1\"', + 'v1/prog_index.m3u8' + ], timeline: 0, uri: 'v1/prog_index.m3u8' }, @@ -338,6 +402,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2198334,BANDWIDTH=2248329,CODECS=\"avc1.640020,ec-3\",RESOLUTION=960x540,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud3\",SUBTITLES=\"sub1\"', + 'v4/prog_index.m3u8' + ], timeline: 0, uri: 'v4/prog_index.m3u8' }, @@ -355,6 +423,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=7995954,BANDWIDTH=8009540,CODECS=\"avc1.64002a,ec-3\",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud3\",SUBTITLES=\"sub1\"', + 'v8/prog_index.m3u8' + ], timeline: 0, uri: 'v8/prog_index.m3u8' }, @@ -372,6 +444,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6198134,BANDWIDTH=6214995,CODECS=\"avc1.64002a,ec-3\",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud3\",SUBTITLES=\"sub1\"', + 'v7/prog_index.m3u8' + ], timeline: 0, uri: 'v7/prog_index.m3u8' }, @@ -389,6 +465,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4697569,BANDWIDTH=4715776,CODECS=\"avc1.64002a,ec-3\",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud3\",SUBTITLES=\"sub1\"', + 'v6/prog_index.m3u8' + ], timeline: 0, uri: 'v6/prog_index.m3u8' }, @@ -406,6 +486,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3197869,BANDWIDTH=3203856,CODECS=\"avc1.640020,ec-3\",RESOLUTION=1280x720,FRAME-RATE=59.940,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud3\",SUBTITLES=\"sub1\"', + 'v5/prog_index.m3u8' + ], timeline: 0, uri: 'v5/prog_index.m3u8' }, @@ -423,6 +507,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1295662,BANDWIDTH=1309333,CODECS=\"avc1.64001e,ec-3\",RESOLUTION=768x432,FRAME-RATE=29.970,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud3\",SUBTITLES=\"sub1\"', + 'v3/prog_index.m3u8' + ], timeline: 0, uri: 'v3/prog_index.m3u8' }, @@ -440,6 +528,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=926353,BANDWIDTH=937854,CODECS=\"avc1.64001e,ec-3\",RESOLUTION=640x360,FRAME-RATE=29.970,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud3\",SUBTITLES=\"sub1\"', + 'v2/prog_index.m3u8' + ], timeline: 0, uri: 'v2/prog_index.m3u8' }, @@ -457,6 +549,10 @@ module.exports = { }, 'SUBTITLES': 'sub1' }, + raw: [ + '#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=560783,BANDWIDTH=571311,CODECS=\"avc1.640015,ec-3\",RESOLUTION=480x270,FRAME-RATE=29.970,CLOSED-CAPTIONS=\"cc1\",AUDIO=\"aud3\",SUBTITLES=\"sub1\"', + 'v1/prog_index.m3u8' + ], timeline: 0, uri: 'v1/prog_index.m3u8' }], diff --git a/test/fixtures/integration/master.js b/test/fixtures/integration/master.js index 62cedc5..8a3a5be 100644 --- a/test/fixtures/integration/master.js +++ b/test/fixtures/integration/master.js @@ -10,6 +10,10 @@ module.exports = { height: 224 } }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=396x224', + 'media.m3u8' + ], timeline: 0, uri: 'media.m3u8' }, @@ -18,6 +22,10 @@ module.exports = { 'PROGRAM-ID': 1, 'BANDWIDTH': 40000 }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000', + 'media1.m3u8' + ], timeline: 0, uri: 'media1.m3u8' }, @@ -30,6 +38,10 @@ module.exports = { height: 224 } }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000,RESOLUTION=396x224', + 'media2.m3u8' + ], timeline: 0, uri: 'media2.m3u8' }, @@ -42,6 +54,10 @@ module.exports = { height: 540 } }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540', + 'media3.m3u8' + ], timeline: 0, uri: 'media3.m3u8' } diff --git a/test/fixtures/integration/media.js b/test/fixtures/integration/media.js index cb31c67..652eeaa 100644 --- a/test/fixtures/integration/media.js +++ b/test/fixtures/integration/media.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + 'media-00001.ts' + ], timeline: 0, uri: 'media-00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'media-00002.ts' + ], timeline: 0, uri: 'media-00002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'media-00003.ts' + ], timeline: 0, uri: 'media-00003.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'media-00004.ts' + ], timeline: 0, uri: 'media-00004.ts' } diff --git a/test/fixtures/integration/mediaSequence.js b/test/fixtures/integration/mediaSequence.js index d927c98..6354ce2 100644 --- a/test/fixtures/integration/mediaSequence.js +++ b/test/fixtures/integration/mediaSequence.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' }, { duration: 6.08, + raw: [ + '#EXTINF:6.080,{}', + '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' }, { duration: 6.6, + raw: [ + '#EXTINF:6.600,{}', + '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' }, { duration: 5, + raw: [ + '#EXTINF:5.000,{}', + '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' } diff --git a/test/fixtures/integration/missingEndlist.js b/test/fixtures/integration/missingEndlist.js index 6683786..a8a159a 100644 --- a/test/fixtures/integration/missingEndlist.js +++ b/test/fixtures/integration/missingEndlist.js @@ -4,11 +4,19 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + '00001.ts' + ], timeline: 0, uri: '00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '00002.ts' + ], timeline: 0, uri: '00002.ts' } diff --git a/test/fixtures/integration/missingExtinf.js b/test/fixtures/integration/missingExtinf.js index 670de8d..ca3de2f 100644 --- a/test/fixtures/integration/missingExtinf.js +++ b/test/fixtures/integration/missingExtinf.js @@ -5,16 +5,27 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, { duration: 10, + raw: [ + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/missingMediaSequence.js b/test/fixtures/integration/missingMediaSequence.js index d927c98..6354ce2 100644 --- a/test/fixtures/integration/missingMediaSequence.js +++ b/test/fixtures/integration/missingMediaSequence.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' }, { duration: 6.08, + raw: [ + '#EXTINF:6.080,{}', + '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' }, { duration: 6.6, + raw: [ + '#EXTINF:6.600,{}', + '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' }, { duration: 5, + raw: [ + '#EXTINF:5.000,{}', + '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' } diff --git a/test/fixtures/integration/missingSegmentDuration.js b/test/fixtures/integration/missingSegmentDuration.js index a5889a9..b9597fa 100644 --- a/test/fixtures/integration/missingSegmentDuration.js +++ b/test/fixtures/integration/missingSegmentDuration.js @@ -5,21 +5,34 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' }, { duration: 8, + raw: [ + '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' }, { duration: 8, + raw: [ + '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' }, { duration: 8, + raw: [ + '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' } diff --git a/test/fixtures/integration/multipleAudioGroups.js b/test/fixtures/integration/multipleAudioGroups.js index c5dc8e4..71b7ee3 100644 --- a/test/fixtures/integration/multipleAudioGroups.js +++ b/test/fixtures/integration/multipleAudioGroups.js @@ -55,6 +55,10 @@ module.exports = { 'CODECS': 'mp4a.40.5', 'AUDIO': 'audio-lo' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS=\"mp4a.40.5\", AUDIO=\"audio-lo\"', + 'lo/prog_index.m3u8' + ], timeline: 0, uri: 'lo/prog_index.m3u8' }, { @@ -64,6 +68,10 @@ module.exports = { 'CODECS': 'avc1.42e01e,mp4a.40.2', 'AUDIO': 'audio-lo' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=260000,CODECS=\"avc1.42e01e,mp4a.40.2\", AUDIO=\"audio-lo\"', + 'lo2/prog_index.m3u8' + ], timeline: 0, uri: 'lo2/prog_index.m3u8' }, { @@ -73,6 +81,10 @@ module.exports = { 'CODECS': 'mp4a.40.2, avc1.64001e', 'AUDIO': 'audio-hi' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS=\"mp4a.40.2, avc1.64001e\", AUDIO=\"audio-hi\"', + 'hi/prog_index.m3u8' + ], timeline: 0, uri: 'hi/prog_index.m3u8' }, { @@ -82,6 +94,10 @@ module.exports = { 'CODECS': 'avc1.42e01e,mp4a.40.2', 'AUDIO': 'audio-hi' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=650000,CODECS=\"avc1.42e01e,mp4a.40.2\", AUDIO=\"audio-hi\"', + 'hi2/prog_index.m3u8' + ], timeline: 0, uri: 'hi2/prog_index.m3u8' }], diff --git a/test/fixtures/integration/multipleAudioGroupsCombinedMain.js b/test/fixtures/integration/multipleAudioGroupsCombinedMain.js index 42ece74..65632f7 100644 --- a/test/fixtures/integration/multipleAudioGroupsCombinedMain.js +++ b/test/fixtures/integration/multipleAudioGroupsCombinedMain.js @@ -54,6 +54,10 @@ module.exports = { 'CODECS': 'mp4a.40.5', 'AUDIO': 'audio-lo' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS=\"mp4a.40.5\", AUDIO=\"audio-lo\"', + 'lo/prog_index.m3u8' + ], timeline: 0, uri: 'lo/prog_index.m3u8' }, { @@ -63,6 +67,10 @@ module.exports = { 'CODECS': 'avc1.42e01e,mp4a.40.2', 'AUDIO': 'audio-lo' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=260000,CODECS=\"avc1.42e01e,mp4a.40.2\", AUDIO=\"audio-lo\"', + 'lo2/prog_index.m3u8' + ], timeline: 0, uri: 'lo2/prog_index.m3u8' }, { @@ -72,6 +80,10 @@ module.exports = { 'CODECS': 'mp4a.40.2, avc1.64001e', 'AUDIO': 'audio-hi' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS=\"mp4a.40.2, avc1.64001e\", AUDIO=\"audio-hi\"', + 'hi/prog_index.m3u8' + ], timeline: 0, uri: 'hi/prog_index.m3u8' }, { @@ -81,6 +93,10 @@ module.exports = { 'CODECS': 'avc1.42e01e,mp4a.40.2', 'AUDIO': 'audio-hi' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=650000,CODECS=\"avc1.42e01e,mp4a.40.2\", AUDIO=\"audio-hi\"', + 'hi2/prog_index.m3u8' + ], timeline: 0, uri: 'hi2/prog_index.m3u8' }], diff --git a/test/fixtures/integration/multipleTargetDurations.js b/test/fixtures/integration/multipleTargetDurations.js index 70a1f37..f00a3d7 100644 --- a/test/fixtures/integration/multipleTargetDurations.js +++ b/test/fixtures/integration/multipleTargetDurations.js @@ -5,21 +5,34 @@ module.exports = { segments: [ { uri: '001.ts', + raw: [ + '001.ts' + ], timeline: 0 }, { uri: '002.ts', duration: 9, + raw: [ + '002.ts' + ], timeline: 0 }, { uri: '003.ts', duration: 7, + raw: [ + '#EXTINF:7', + '003.ts' + ], timeline: 0 }, { uri: '004.ts', duration: 10, + raw: [ + '004.ts' + ], timeline: 0 } ], diff --git a/test/fixtures/integration/multipleVideo.js b/test/fixtures/integration/multipleVideo.js index d5beda5..54afe5b 100644 --- a/test/fixtures/integration/multipleVideo.js +++ b/test/fixtures/integration/multipleVideo.js @@ -57,6 +57,10 @@ module.exports = { 'AUDIO': 'aac', 'VIDEO': '200kbs' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=300000,CODECS=\"mp4a.40.2,avc1.4d401e\",VIDEO=\"200kbs\",AUDIO=\"aac\"', + 'Angle1/200kbs/prog_index.m3u' + ], timeline: 0, uri: 'Angle1/200kbs/prog_index.m3u' }, { @@ -67,6 +71,10 @@ module.exports = { 'AUDIO': 'aac', 'VIDEO': '500kbs' }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=754857,CODECS=\"mp4a.40.2,avc1.4d401e\",VIDEO=\"500kbs\",AUDIO=\"aac\"', + 'Angle1/500kbs/prog_index.m3u8' + ], timeline: 0, uri: 'Angle1/500kbs/prog_index.m3u8' }], diff --git a/test/fixtures/integration/negativeMediaSequence.js b/test/fixtures/integration/negativeMediaSequence.js index 7069dde..26faf83 100644 --- a/test/fixtures/integration/negativeMediaSequence.js +++ b/test/fixtures/integration/negativeMediaSequence.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' }, { duration: 6.08, + raw: [ + '#EXTINF:6.080,{}', + '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' }, { duration: 6.6, + raw: [ + '#EXTINF:6.600,{}', + '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' }, { duration: 5, + raw: [ + '#EXTINF:5.000,{}', + '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' } diff --git a/test/fixtures/integration/playlist.js b/test/fixtures/integration/playlist.js index b034613..2d0ac67 100644 --- a/test/fixtures/integration/playlist.js +++ b/test/fixtures/integration/playlist.js @@ -9,6 +9,11 @@ module.exports = { offset: 0 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:522828@0', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -18,6 +23,11 @@ module.exports = { offset: 522828 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:587500@522828', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -27,6 +37,11 @@ module.exports = { offset: 1110328 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:713084@1110328', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -36,6 +51,11 @@ module.exports = { offset: 1823412 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:476580@1823412', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -45,6 +65,11 @@ module.exports = { offset: 2299992 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:535612@2299992', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -54,6 +79,11 @@ module.exports = { offset: 2835604 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:207176@2835604', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -63,6 +93,11 @@ module.exports = { offset: 3042780 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:455900@3042780', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -72,6 +107,11 @@ module.exports = { offset: 3498680 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:657248@3498680', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -81,6 +121,11 @@ module.exports = { offset: 4155928 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:571708@4155928', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -90,6 +135,11 @@ module.exports = { offset: 4727636 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:485040@4727636', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -99,6 +149,11 @@ module.exports = { offset: 5212676 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:709136@5212676', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -108,6 +163,11 @@ module.exports = { offset: 5921812 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:730004@5921812', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -117,6 +177,11 @@ module.exports = { offset: 6651816 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:456276@6651816', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -126,6 +191,11 @@ module.exports = { offset: 7108092 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:468684@7108092', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -135,6 +205,11 @@ module.exports = { offset: 7576776 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:444996@7576776', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -144,6 +219,11 @@ module.exports = { offset: 8021772 }, duration: 10, + raw: [ + '#EXTINF:10,', + '#EXT-X-BYTERANGE:331444@8021772', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' }, @@ -153,6 +233,11 @@ module.exports = { offset: 8353216 }, duration: 1.4167, + raw: [ + '#EXTINF:1.4167,', + '#EXT-X-BYTERANGE:44556@8353216', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/playlistMediaSequenceHigher.js b/test/fixtures/integration/playlistMediaSequenceHigher.js index 6a29b03..e20910a 100644 --- a/test/fixtures/integration/playlistMediaSequenceHigher.js +++ b/test/fixtures/integration/playlistMediaSequenceHigher.js @@ -5,6 +5,10 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' } diff --git a/test/fixtures/integration/start.js b/test/fixtures/integration/start.js index c864bfc..c566336 100644 --- a/test/fixtures/integration/start.js +++ b/test/fixtures/integration/start.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + 'media-00001.ts' + ], timeline: 0, uri: 'media-00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'media-00002.ts' + ], timeline: 0, uri: 'media-00002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'media-00003.ts' + ], timeline: 0, uri: 'media-00003.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'media-00004.ts' + ], timeline: 0, uri: 'media-00004.ts' } diff --git a/test/fixtures/integration/streamInfInvalid.js b/test/fixtures/integration/streamInfInvalid.js index 4fbecf0..cc04515 100644 --- a/test/fixtures/integration/streamInfInvalid.js +++ b/test/fixtures/integration/streamInfInvalid.js @@ -5,10 +5,18 @@ module.exports = { attributes: { 'PROGRAM-ID': 1 }, + raw: [ + '#EXT-X-STREAM-INF:PROGRAM-ID=1', + 'media.m3u8' + ], timeline: 0, uri: 'media.m3u8' }, { + raw: [ + '#EXT-X-STREAM-INF:', + 'media1.m3u8' + ], timeline: 0, uri: 'media1.m3u8' } diff --git a/test/fixtures/integration/twoMediaSequences.js b/test/fixtures/integration/twoMediaSequences.js index 46b73bb..288860d 100644 --- a/test/fixtures/integration/twoMediaSequences.js +++ b/test/fixtures/integration/twoMediaSequences.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 6.64, + raw: [ + '#EXTINF:6.640,{}', + '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' }, { duration: 6.08, + raw: [ + '#EXTINF:6.080,{}', + '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' }, { duration: 6.6, + raw: [ + '#EXTINF:6.600,{}', + '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' }, { duration: 5, + raw: [ + '#EXTINF:5.000,{}', + '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + ], timeline: 0, uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' } diff --git a/test/fixtures/integration/versionInvalid.js b/test/fixtures/integration/versionInvalid.js index ba78123..c46e19c 100644 --- a/test/fixtures/integration/versionInvalid.js +++ b/test/fixtures/integration/versionInvalid.js @@ -5,6 +5,10 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + 'hls_450k_video.ts' + ], timeline: 0, uri: 'hls_450k_video.ts' } diff --git a/test/fixtures/integration/whiteSpace.js b/test/fixtures/integration/whiteSpace.js index 370c8c1..d20ea8b 100644 --- a/test/fixtures/integration/whiteSpace.js +++ b/test/fixtures/integration/whiteSpace.js @@ -5,21 +5,37 @@ module.exports = { segments: [ { duration: 10, + raw: [ + '#EXTINF:10,', + 'http://example.com/00001.ts' + ], timeline: 0, uri: 'http://example.com/00001.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'https://example.com/00002.ts' + ], timeline: 0, uri: 'https://example.com/00002.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + '//example.com/00003.ts' + ], timeline: 0, uri: '//example.com/00003.ts' }, { duration: 10, + raw: [ + '#EXTINF:10,', + 'http://example.com/00004.ts' + ], timeline: 0, uri: 'http://example.com/00004.ts' } diff --git a/test/fixtures/integration/zeroDuration.js b/test/fixtures/integration/zeroDuration.js index d5ecdaf..3bf1793 100644 --- a/test/fixtures/integration/zeroDuration.js +++ b/test/fixtures/integration/zeroDuration.js @@ -5,6 +5,10 @@ module.exports = { segments: [ { duration: 0.01, + raw: [ + '#EXTINF:0,', + 'http://example.com/00001.ts' + ], timeline: 0, uri: 'http://example.com/00001.ts' } diff --git a/test/parse-stream.test.js b/test/parse-stream.test.js index c9cf912..3c221ca 100644 --- a/test/parse-stream.test.js +++ b/test/parse-stream.test.js @@ -78,7 +78,8 @@ QUnit.test('mapper does not conflict with parser', function(assert) { }); assert.deepEqual(dataCallback.getCall(2).args[0], { text: 'SOMETHING-ELSE', - type: 'comment' + type: 'comment', + raw: '#SOMETHING-ELSE' }); }); @@ -100,11 +101,13 @@ QUnit.test('maps custom tags', function(assert) { assert.deepEqual(dataCallback.getCall(0).args[0], { text: 'EXAMPLE', - type: 'comment' + type: 'comment', + raw: '#EXAMPLE' }); assert.deepEqual(dataCallback.getCall(1).args[0], { text: 'NEW-COMMENT', - type: 'comment' + type: 'comment', + raw: '#NEW-COMMENT' }); }); @@ -137,12 +140,14 @@ QUnit.test('maps multiple custom tags', function(assert) { assert.deepEqual(dataCallback.getCall(0).args[0], { text: 'VOD-STARTTIMESTAMP:1501533337573', - type: 'comment' + type: 'comment', + raw: '#VOD-STARTTIMESTAMP:1501533337573' }); assert.deepEqual(dataCallback.getCall(1).args[0], { text: 'NEW-COMMENT', - type: 'comment' + type: 'comment', + raw: '#NEW-COMMENT' }); const dateTag = dataCallback.getCall(2).args[0]; @@ -169,7 +174,8 @@ QUnit.test('mapper ignores tags', function(assert) { assert.strictEqual(dataCallback.callCount, 1); assert.deepEqual(dataCallback.getCall(0).args[0], { text: 'TAG', - type: 'comment' + type: 'comment', + raw: '#TAG' }); }); @@ -752,7 +758,8 @@ QUnit.test('parses valid #EXT-X-KEY tags', function(assert) { attributes: { METHOD: 'AES-128', URI: 'https://priv.example.com/key.php?r=52' - } + }, + raw: '#EXT-X-KEY:METHOD=AES-128,URI=\"https://priv.example.com/key.php?r=52\"' }, 'parsed a valid key'); manifest = '#EXT-X-KEY:URI="https://example.com/key#1",METHOD=FutureType-1024\n'; @@ -764,7 +771,8 @@ QUnit.test('parses valid #EXT-X-KEY tags', function(assert) { attributes: { METHOD: 'FutureType-1024', URI: 'https://example.com/key#1' - } + }, + raw: '#EXT-X-KEY:URI=\"https://example.com/key#1\",METHOD=FutureType-1024' }, 'parsed the attribute list independent of order'); manifest = '#EXT-X-KEY:IV=1234567890abcdef1234567890abcdef\n'; @@ -790,7 +798,8 @@ QUnit.test('parses minimal #EXT-X-KEY tags', function(assert) { assert.ok(element, 'an event was triggered'); assert.deepEqual(element, { type: 'tag', - tagType: 'key' + tagType: 'key', + raw: '#EXT-X-KEY:' }, 'parsed a minimal key tag'); }); From 411792a3f1501f28df53b700c3964bb36dbbb95f Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 13 Jul 2021 23:32:06 -0400 Subject: [PATCH 2/2] added feature flag --- scripts/rollup.config.js | 6 +- src/parse-stream.js | 61 +-- src/parser.js | 60 ++- .../{ => with-raw}/absoluteUris.js | 0 .../{ => with-raw}/absoluteUris.m3u8 | 0 .../integration/{ => with-raw}/allowCache.js | 0 .../{ => with-raw}/allowCache.m3u8 | 0 .../{ => with-raw}/allowCacheInvalid.js | 0 .../{ => with-raw}/allowCacheInvalid.m3u8 | 0 .../{ => with-raw}/alternateAudio.js | 0 .../{ => with-raw}/alternateAudio.m3u8 | 0 .../{ => with-raw}/alternateVideo.js | 0 .../{ => with-raw}/alternateVideo.m3u8 | 0 .../integration/{ => with-raw}/brightcove.js | 0 .../{ => with-raw}/brightcove.m3u8 | 0 .../integration/{ => with-raw}/byteRange.js | 0 .../integration/{ => with-raw}/byteRange.m3u8 | 0 .../integration/{ => with-raw}/dateTime.js | 0 .../integration/{ => with-raw}/dateTime.m3u8 | 0 .../{ => with-raw}/diff-init-key.js | 0 .../{ => with-raw}/diff-init-key.m3u8 | 0 .../{ => with-raw}/disallowCache.js | 0 .../{ => with-raw}/disallowCache.m3u8 | 0 .../{ => with-raw}/disc-sequence.js | 0 .../{ => with-raw}/disc-sequence.m3u8 | 0 .../{ => with-raw}/discontinuity.js | 0 .../{ => with-raw}/discontinuity.m3u8 | 0 .../integration/{ => with-raw}/domainUris.js | 0 .../{ => with-raw}/domainUris.m3u8 | 0 .../integration/{ => with-raw}/empty.js | 0 .../integration/{ => with-raw}/empty.m3u8 | 0 .../{ => with-raw}/emptyAllowCache.js | 0 .../{ => with-raw}/emptyAllowCache.m3u8 | 0 .../{ => with-raw}/emptyMediaSequence.js | 0 .../{ => with-raw}/emptyMediaSequence.m3u8 | 0 .../{ => with-raw}/emptyPlaylistType.js | 0 .../{ => with-raw}/emptyPlaylistType.m3u8 | 0 .../{ => with-raw}/emptyTargetDuration.js | 0 .../{ => with-raw}/emptyTargetDuration.m3u8 | 0 .../integration/{ => with-raw}/encrypted.js | 0 .../integration/{ => with-raw}/encrypted.m3u8 | 0 .../integration/{ => with-raw}/event.js | 0 .../integration/{ => with-raw}/event.m3u8 | 0 .../extXPlaylistTypeInvalidPlaylist.js | 0 .../extXPlaylistTypeInvalidPlaylist.m3u8 | 0 .../integration/{ => with-raw}/extinf.js | 0 .../integration/{ => with-raw}/extinf.m3u8 | 0 .../integration/{ => with-raw}/fmp4.js | 0 .../integration/{ => with-raw}/fmp4.m3u8 | 0 .../integration/{ => with-raw}/headerOnly.js | 0 .../{ => with-raw}/headerOnly.m3u8 | 0 .../{ => with-raw}/invalidAllowCache.js | 0 .../{ => with-raw}/invalidAllowCache.m3u8 | 0 .../{ => with-raw}/invalidMediaSequence.js | 0 .../{ => with-raw}/invalidMediaSequence.m3u8 | 0 .../{ => with-raw}/invalidPlaylistType.js | 0 .../{ => with-raw}/invalidPlaylistType.m3u8 | 0 .../{ => with-raw}/invalidTargetDuration.js | 0 .../{ => with-raw}/invalidTargetDuration.m3u8 | 0 .../liveMissingSegmentDuration.js | 0 .../liveMissingSegmentDuration.m3u8 | 0 .../{ => with-raw}/liveStart30sBefore.js | 0 .../{ => with-raw}/liveStart30sBefore.m3u8 | 0 .../{ => with-raw}/llhls-byte-range.js | 0 .../{ => with-raw}/llhls-byte-range.m3u8 | 0 .../{ => with-raw}/llhls-delta-byte-range.js | 0 .../llhls-delta-byte-range.m3u8 | 0 .../integration/{ => with-raw}/llhls.js | 0 .../integration/{ => with-raw}/llhls.m3u8 | 0 .../integration/{ => with-raw}/llhlsDelta.js | 0 .../{ => with-raw}/llhlsDelta.m3u8 | 0 .../manifestExtTTargetdurationNegative.js | 0 .../manifestExtTTargetdurationNegative.m3u8 | 0 .../manifestExtXEndlistEarly.js | 0 .../manifestExtXEndlistEarly.m3u8 | 0 .../{ => with-raw}/manifestNoExtM3u.js | 0 .../{ => with-raw}/manifestNoExtM3u.m3u8 | 0 .../integration/{ => with-raw}/master-fmp4.js | 0 .../{ => with-raw}/master-fmp4.m3u8 | 0 .../integration/{ => with-raw}/master.js | 0 .../integration/{ => with-raw}/master.m3u8 | 0 .../integration/{ => with-raw}/media.js | 0 .../integration/{ => with-raw}/media.m3u8 | 0 .../{ => with-raw}/mediaSequence.js | 0 .../{ => with-raw}/mediaSequence.m3u8 | 0 .../{ => with-raw}/missingEndlist.js | 0 .../{ => with-raw}/missingEndlist.m3u8 | 0 .../{ => with-raw}/missingExtinf.js | 0 .../{ => with-raw}/missingExtinf.m3u8 | 0 .../{ => with-raw}/missingMediaSequence.js | 0 .../{ => with-raw}/missingMediaSequence.m3u8 | 0 .../{ => with-raw}/missingSegmentDuration.js | 0 .../missingSegmentDuration.m3u8 | 0 .../{ => with-raw}/multipleAudioGroups.js | 0 .../{ => with-raw}/multipleAudioGroups.m3u8 | 0 .../multipleAudioGroupsCombinedMain.js | 0 .../multipleAudioGroupsCombinedMain.m3u8 | 0 .../{ => with-raw}/multipleTargetDurations.js | 0 .../multipleTargetDurations.m3u8 | 0 .../{ => with-raw}/multipleVideo.js | 0 .../{ => with-raw}/multipleVideo.m3u8 | 0 .../{ => with-raw}/negativeMediaSequence.js | 0 .../{ => with-raw}/negativeMediaSequence.m3u8 | 0 .../integration/{ => with-raw}/playlist.js | 0 .../integration/{ => with-raw}/playlist.m3u8 | 0 .../playlistMediaSequenceHigher.js | 0 .../playlistMediaSequenceHigher.m3u8 | 0 .../integration/{ => with-raw}/start.js | 0 .../integration/{ => with-raw}/start.m3u8 | 0 .../{ => with-raw}/streamInfInvalid.js | 0 .../{ => with-raw}/streamInfInvalid.m3u8 | 0 .../{ => with-raw}/twoMediaSequences.js | 0 .../{ => with-raw}/twoMediaSequences.m3u8 | 0 .../{ => with-raw}/versionInvalid.js | 0 .../{ => with-raw}/versionInvalid.m3u8 | 0 .../integration/{ => with-raw}/whiteSpace.js | 0 .../{ => with-raw}/whiteSpace.m3u8 | 0 .../{ => with-raw}/zeroDuration.js | 0 .../{ => with-raw}/zeroDuration.m3u8 | 0 .../integration/without-raw/absoluteUris.js | 35 ++ .../integration/without-raw/absoluteUris.m3u8 | 12 + .../integration/without-raw/allowCache.js | 182 +++++++ .../integration/without-raw/allowCache.m3u8 | 58 +++ .../without-raw/allowCacheInvalid.js | 22 + .../without-raw/allowCacheInvalid.m3u8 | 10 + .../integration/without-raw/alternateAudio.js | 58 +++ .../without-raw/alternateAudio.m3u8 | 9 + .../integration/without-raw/alternateVideo.js | 49 ++ .../without-raw/alternateVideo.m3u8 | 8 + .../integration/without-raw/brightcove.js | 61 +++ .../integration/without-raw/brightcove.m3u8 | 9 + .../integration/without-raw/byteRange.js | 178 +++++++ .../integration/without-raw/byteRange.m3u8 | 56 ++ .../integration/without-raw/dateTime.js | 29 ++ .../integration/without-raw/dateTime.m3u8 | 12 + .../integration/without-raw/diff-init-key.js | 175 +++++++ .../without-raw/diff-init-key.m3u8 | 57 ++ .../integration/without-raw/disallowCache.js | 22 + .../without-raw/disallowCache.m3u8 | 10 + .../integration/without-raw/disc-sequence.js | 36 ++ .../without-raw/disc-sequence.m3u8 | 15 + .../integration/without-raw/discontinuity.js | 68 +++ .../without-raw/discontinuity.m3u8 | 26 + .../integration/without-raw/domainUris.js | 35 ++ .../integration/without-raw/domainUris.m3u8 | 12 + .../fixtures/integration/without-raw/empty.js | 5 + .../integration/without-raw/empty.m3u8 | 0 .../without-raw/emptyAllowCache.js | 22 + .../without-raw/emptyAllowCache.m3u8 | 10 + .../without-raw/emptyMediaSequence.js | 35 ++ .../without-raw/emptyMediaSequence.m3u8 | 14 + .../without-raw/emptyPlaylistType.js | 46 ++ .../without-raw/emptyPlaylistType.m3u8 | 16 + .../without-raw/emptyTargetDuration.js | 61 +++ .../without-raw/emptyTargetDuration.m3u8 | 10 + .../integration/without-raw/encrypted.js | 67 +++ .../integration/without-raw/encrypted.m3u8 | 28 + .../fixtures/integration/without-raw/event.js | 47 ++ .../integration/without-raw/event.m3u8 | 16 + .../extXPlaylistTypeInvalidPlaylist.js | 16 + .../extXPlaylistTypeInvalidPlaylist.m3u8 | 8 + .../integration/without-raw/extinf.js | 182 +++++++ .../integration/without-raw/extinf.m3u8 | 57 ++ test/fixtures/integration/without-raw/fmp4.js | 46 ++ .../integration/without-raw/fmp4.m3u8 | 14 + .../integration/without-raw/headerOnly.js | 5 + .../integration/without-raw/headerOnly.m3u8 | 1 + .../without-raw/invalidAllowCache.js | 22 + .../without-raw/invalidAllowCache.m3u8 | 10 + .../without-raw/invalidMediaSequence.js | 35 ++ .../without-raw/invalidMediaSequence.m3u8 | 14 + .../without-raw/invalidPlaylistType.js | 46 ++ .../without-raw/invalidPlaylistType.m3u8 | 16 + .../without-raw/invalidTargetDuration.js | 181 +++++++ .../without-raw/invalidTargetDuration.m3u8 | 57 ++ .../without-raw/liveMissingSegmentDuration.js | 28 + .../liveMissingSegmentDuration.m3u8 | 9 + .../without-raw/liveStart30sBefore.js | 63 +++ .../without-raw/liveStart30sBefore.m3u8 | 22 + .../without-raw/llhls-byte-range.js | 271 ++++++++++ .../without-raw/llhls-byte-range.m3u8 | 66 +++ .../without-raw/llhls-delta-byte-range.js | 154 ++++++ .../without-raw/llhls-delta-byte-range.m3u8 | 30 ++ .../fixtures/integration/without-raw/llhls.js | 222 ++++++++ .../integration/without-raw/llhls.m3u8 | 56 ++ .../integration/without-raw/llhlsDelta.js | 191 +++++++ .../integration/without-raw/llhlsDelta.m3u8 | 50 ++ .../manifestExtTTargetdurationNegative.js | 15 + .../manifestExtTTargetdurationNegative.m3u8 | 5 + .../without-raw/manifestExtXEndlistEarly.js | 40 ++ .../without-raw/manifestExtXEndlistEarly.m3u8 | 14 + .../without-raw/manifestNoExtM3u.js | 16 + .../without-raw/manifestNoExtM3u.m3u8 | 4 + .../integration/without-raw/master-fmp4.js | 489 ++++++++++++++++++ .../integration/without-raw/master-fmp4.m3u8 | 76 +++ .../integration/without-raw/master.js | 61 +++ .../integration/without-raw/master.m3u8 | 10 + .../fixtures/integration/without-raw/media.js | 35 ++ .../integration/without-raw/media.m3u8 | 12 + .../integration/without-raw/mediaSequence.js | 35 ++ .../without-raw/mediaSequence.m3u8 | 14 + .../integration/without-raw/missingEndlist.js | 21 + .../without-raw/missingEndlist.m3u8 | 6 + .../integration/without-raw/missingExtinf.js | 30 ++ .../without-raw/missingExtinf.m3u8 | 11 + .../without-raw/missingMediaSequence.js | 35 ++ .../without-raw/missingMediaSequence.m3u8 | 13 + .../without-raw/missingSegmentDuration.js | 35 ++ .../without-raw/missingSegmentDuration.m3u8 | 11 + .../without-raw/multipleAudioGroups.js | 93 ++++ .../without-raw/multipleAudioGroups.m3u8 | 17 + .../multipleAudioGroupsCombinedMain.js | 92 ++++ .../multipleAudioGroupsCombinedMain.m3u8 | 17 + .../without-raw/multipleTargetDurations.js | 32 ++ .../without-raw/multipleTargetDurations.m3u8 | 8 + .../integration/without-raw/multipleVideo.js | 76 +++ .../without-raw/multipleVideo.m3u8 | 16 + .../without-raw/negativeMediaSequence.js | 35 ++ .../without-raw/negativeMediaSequence.m3u8 | 14 + .../integration/without-raw/playlist.js | 182 +++++++ .../integration/without-raw/playlist.m3u8 | 57 ++ .../playlistMediaSequenceHigher.js | 17 + .../playlistMediaSequenceHigher.m3u8 | 8 + .../fixtures/integration/without-raw/start.js | 40 ++ .../integration/without-raw/start.m3u8 | 13 + .../without-raw/streamInfInvalid.js | 26 + .../without-raw/streamInfInvalid.m3u8 | 6 + .../without-raw/twoMediaSequences.js | 35 ++ .../without-raw/twoMediaSequences.m3u8 | 15 + .../integration/without-raw/versionInvalid.js | 17 + .../without-raw/versionInvalid.m3u8 | 8 + .../integration/without-raw/whiteSpace.js | 35 ++ .../integration/without-raw/whiteSpace.m3u8 | 13 + .../integration/without-raw/zeroDuration.js | 17 + .../integration/without-raw/zeroDuration.m3u8 | 7 + test/parse-stream.test.js | 216 +++++++- test/parser.test.js | 25 + 237 files changed, 5695 insertions(+), 50 deletions(-) rename test/fixtures/integration/{ => with-raw}/absoluteUris.js (100%) rename test/fixtures/integration/{ => with-raw}/absoluteUris.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/allowCache.js (100%) rename test/fixtures/integration/{ => with-raw}/allowCache.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/allowCacheInvalid.js (100%) rename test/fixtures/integration/{ => with-raw}/allowCacheInvalid.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/alternateAudio.js (100%) rename test/fixtures/integration/{ => with-raw}/alternateAudio.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/alternateVideo.js (100%) rename test/fixtures/integration/{ => with-raw}/alternateVideo.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/brightcove.js (100%) rename test/fixtures/integration/{ => with-raw}/brightcove.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/byteRange.js (100%) rename test/fixtures/integration/{ => with-raw}/byteRange.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/dateTime.js (100%) rename test/fixtures/integration/{ => with-raw}/dateTime.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/diff-init-key.js (100%) rename test/fixtures/integration/{ => with-raw}/diff-init-key.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/disallowCache.js (100%) rename test/fixtures/integration/{ => with-raw}/disallowCache.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/disc-sequence.js (100%) rename test/fixtures/integration/{ => with-raw}/disc-sequence.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/discontinuity.js (100%) rename test/fixtures/integration/{ => with-raw}/discontinuity.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/domainUris.js (100%) rename test/fixtures/integration/{ => with-raw}/domainUris.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/empty.js (100%) rename test/fixtures/integration/{ => with-raw}/empty.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/emptyAllowCache.js (100%) rename test/fixtures/integration/{ => with-raw}/emptyAllowCache.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/emptyMediaSequence.js (100%) rename test/fixtures/integration/{ => with-raw}/emptyMediaSequence.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/emptyPlaylistType.js (100%) rename test/fixtures/integration/{ => with-raw}/emptyPlaylistType.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/emptyTargetDuration.js (100%) rename test/fixtures/integration/{ => with-raw}/emptyTargetDuration.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/encrypted.js (100%) rename test/fixtures/integration/{ => with-raw}/encrypted.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/event.js (100%) rename test/fixtures/integration/{ => with-raw}/event.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/extXPlaylistTypeInvalidPlaylist.js (100%) rename test/fixtures/integration/{ => with-raw}/extXPlaylistTypeInvalidPlaylist.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/extinf.js (100%) rename test/fixtures/integration/{ => with-raw}/extinf.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/fmp4.js (100%) rename test/fixtures/integration/{ => with-raw}/fmp4.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/headerOnly.js (100%) rename test/fixtures/integration/{ => with-raw}/headerOnly.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/invalidAllowCache.js (100%) rename test/fixtures/integration/{ => with-raw}/invalidAllowCache.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/invalidMediaSequence.js (100%) rename test/fixtures/integration/{ => with-raw}/invalidMediaSequence.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/invalidPlaylistType.js (100%) rename test/fixtures/integration/{ => with-raw}/invalidPlaylistType.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/invalidTargetDuration.js (100%) rename test/fixtures/integration/{ => with-raw}/invalidTargetDuration.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/liveMissingSegmentDuration.js (100%) rename test/fixtures/integration/{ => with-raw}/liveMissingSegmentDuration.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/liveStart30sBefore.js (100%) rename test/fixtures/integration/{ => with-raw}/liveStart30sBefore.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/llhls-byte-range.js (100%) rename test/fixtures/integration/{ => with-raw}/llhls-byte-range.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/llhls-delta-byte-range.js (100%) rename test/fixtures/integration/{ => with-raw}/llhls-delta-byte-range.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/llhls.js (100%) rename test/fixtures/integration/{ => with-raw}/llhls.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/llhlsDelta.js (100%) rename test/fixtures/integration/{ => with-raw}/llhlsDelta.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/manifestExtTTargetdurationNegative.js (100%) rename test/fixtures/integration/{ => with-raw}/manifestExtTTargetdurationNegative.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/manifestExtXEndlistEarly.js (100%) rename test/fixtures/integration/{ => with-raw}/manifestExtXEndlistEarly.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/manifestNoExtM3u.js (100%) rename test/fixtures/integration/{ => with-raw}/manifestNoExtM3u.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/master-fmp4.js (100%) rename test/fixtures/integration/{ => with-raw}/master-fmp4.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/master.js (100%) rename test/fixtures/integration/{ => with-raw}/master.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/media.js (100%) rename test/fixtures/integration/{ => with-raw}/media.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/mediaSequence.js (100%) rename test/fixtures/integration/{ => with-raw}/mediaSequence.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/missingEndlist.js (100%) rename test/fixtures/integration/{ => with-raw}/missingEndlist.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/missingExtinf.js (100%) rename test/fixtures/integration/{ => with-raw}/missingExtinf.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/missingMediaSequence.js (100%) rename test/fixtures/integration/{ => with-raw}/missingMediaSequence.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/missingSegmentDuration.js (100%) rename test/fixtures/integration/{ => with-raw}/missingSegmentDuration.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/multipleAudioGroups.js (100%) rename test/fixtures/integration/{ => with-raw}/multipleAudioGroups.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/multipleAudioGroupsCombinedMain.js (100%) rename test/fixtures/integration/{ => with-raw}/multipleAudioGroupsCombinedMain.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/multipleTargetDurations.js (100%) rename test/fixtures/integration/{ => with-raw}/multipleTargetDurations.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/multipleVideo.js (100%) rename test/fixtures/integration/{ => with-raw}/multipleVideo.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/negativeMediaSequence.js (100%) rename test/fixtures/integration/{ => with-raw}/negativeMediaSequence.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/playlist.js (100%) rename test/fixtures/integration/{ => with-raw}/playlist.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/playlistMediaSequenceHigher.js (100%) rename test/fixtures/integration/{ => with-raw}/playlistMediaSequenceHigher.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/start.js (100%) rename test/fixtures/integration/{ => with-raw}/start.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/streamInfInvalid.js (100%) rename test/fixtures/integration/{ => with-raw}/streamInfInvalid.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/twoMediaSequences.js (100%) rename test/fixtures/integration/{ => with-raw}/twoMediaSequences.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/versionInvalid.js (100%) rename test/fixtures/integration/{ => with-raw}/versionInvalid.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/whiteSpace.js (100%) rename test/fixtures/integration/{ => with-raw}/whiteSpace.m3u8 (100%) rename test/fixtures/integration/{ => with-raw}/zeroDuration.js (100%) rename test/fixtures/integration/{ => with-raw}/zeroDuration.m3u8 (100%) create mode 100644 test/fixtures/integration/without-raw/absoluteUris.js create mode 100644 test/fixtures/integration/without-raw/absoluteUris.m3u8 create mode 100644 test/fixtures/integration/without-raw/allowCache.js create mode 100644 test/fixtures/integration/without-raw/allowCache.m3u8 create mode 100644 test/fixtures/integration/without-raw/allowCacheInvalid.js create mode 100644 test/fixtures/integration/without-raw/allowCacheInvalid.m3u8 create mode 100644 test/fixtures/integration/without-raw/alternateAudio.js create mode 100644 test/fixtures/integration/without-raw/alternateAudio.m3u8 create mode 100644 test/fixtures/integration/without-raw/alternateVideo.js create mode 100644 test/fixtures/integration/without-raw/alternateVideo.m3u8 create mode 100644 test/fixtures/integration/without-raw/brightcove.js create mode 100644 test/fixtures/integration/without-raw/brightcove.m3u8 create mode 100644 test/fixtures/integration/without-raw/byteRange.js create mode 100644 test/fixtures/integration/without-raw/byteRange.m3u8 create mode 100644 test/fixtures/integration/without-raw/dateTime.js create mode 100644 test/fixtures/integration/without-raw/dateTime.m3u8 create mode 100644 test/fixtures/integration/without-raw/diff-init-key.js create mode 100644 test/fixtures/integration/without-raw/diff-init-key.m3u8 create mode 100644 test/fixtures/integration/without-raw/disallowCache.js create mode 100644 test/fixtures/integration/without-raw/disallowCache.m3u8 create mode 100644 test/fixtures/integration/without-raw/disc-sequence.js create mode 100644 test/fixtures/integration/without-raw/disc-sequence.m3u8 create mode 100644 test/fixtures/integration/without-raw/discontinuity.js create mode 100644 test/fixtures/integration/without-raw/discontinuity.m3u8 create mode 100644 test/fixtures/integration/without-raw/domainUris.js create mode 100644 test/fixtures/integration/without-raw/domainUris.m3u8 create mode 100644 test/fixtures/integration/without-raw/empty.js create mode 100644 test/fixtures/integration/without-raw/empty.m3u8 create mode 100644 test/fixtures/integration/without-raw/emptyAllowCache.js create mode 100644 test/fixtures/integration/without-raw/emptyAllowCache.m3u8 create mode 100644 test/fixtures/integration/without-raw/emptyMediaSequence.js create mode 100644 test/fixtures/integration/without-raw/emptyMediaSequence.m3u8 create mode 100644 test/fixtures/integration/without-raw/emptyPlaylistType.js create mode 100644 test/fixtures/integration/without-raw/emptyPlaylistType.m3u8 create mode 100644 test/fixtures/integration/without-raw/emptyTargetDuration.js create mode 100644 test/fixtures/integration/without-raw/emptyTargetDuration.m3u8 create mode 100644 test/fixtures/integration/without-raw/encrypted.js create mode 100644 test/fixtures/integration/without-raw/encrypted.m3u8 create mode 100644 test/fixtures/integration/without-raw/event.js create mode 100644 test/fixtures/integration/without-raw/event.m3u8 create mode 100644 test/fixtures/integration/without-raw/extXPlaylistTypeInvalidPlaylist.js create mode 100644 test/fixtures/integration/without-raw/extXPlaylistTypeInvalidPlaylist.m3u8 create mode 100644 test/fixtures/integration/without-raw/extinf.js create mode 100644 test/fixtures/integration/without-raw/extinf.m3u8 create mode 100644 test/fixtures/integration/without-raw/fmp4.js create mode 100644 test/fixtures/integration/without-raw/fmp4.m3u8 create mode 100644 test/fixtures/integration/without-raw/headerOnly.js create mode 100644 test/fixtures/integration/without-raw/headerOnly.m3u8 create mode 100644 test/fixtures/integration/without-raw/invalidAllowCache.js create mode 100644 test/fixtures/integration/without-raw/invalidAllowCache.m3u8 create mode 100644 test/fixtures/integration/without-raw/invalidMediaSequence.js create mode 100644 test/fixtures/integration/without-raw/invalidMediaSequence.m3u8 create mode 100644 test/fixtures/integration/without-raw/invalidPlaylistType.js create mode 100644 test/fixtures/integration/without-raw/invalidPlaylistType.m3u8 create mode 100644 test/fixtures/integration/without-raw/invalidTargetDuration.js create mode 100644 test/fixtures/integration/without-raw/invalidTargetDuration.m3u8 create mode 100644 test/fixtures/integration/without-raw/liveMissingSegmentDuration.js create mode 100644 test/fixtures/integration/without-raw/liveMissingSegmentDuration.m3u8 create mode 100644 test/fixtures/integration/without-raw/liveStart30sBefore.js create mode 100644 test/fixtures/integration/without-raw/liveStart30sBefore.m3u8 create mode 100644 test/fixtures/integration/without-raw/llhls-byte-range.js create mode 100644 test/fixtures/integration/without-raw/llhls-byte-range.m3u8 create mode 100644 test/fixtures/integration/without-raw/llhls-delta-byte-range.js create mode 100644 test/fixtures/integration/without-raw/llhls-delta-byte-range.m3u8 create mode 100644 test/fixtures/integration/without-raw/llhls.js create mode 100644 test/fixtures/integration/without-raw/llhls.m3u8 create mode 100644 test/fixtures/integration/without-raw/llhlsDelta.js create mode 100644 test/fixtures/integration/without-raw/llhlsDelta.m3u8 create mode 100644 test/fixtures/integration/without-raw/manifestExtTTargetdurationNegative.js create mode 100644 test/fixtures/integration/without-raw/manifestExtTTargetdurationNegative.m3u8 create mode 100644 test/fixtures/integration/without-raw/manifestExtXEndlistEarly.js create mode 100644 test/fixtures/integration/without-raw/manifestExtXEndlistEarly.m3u8 create mode 100644 test/fixtures/integration/without-raw/manifestNoExtM3u.js create mode 100644 test/fixtures/integration/without-raw/manifestNoExtM3u.m3u8 create mode 100644 test/fixtures/integration/without-raw/master-fmp4.js create mode 100644 test/fixtures/integration/without-raw/master-fmp4.m3u8 create mode 100644 test/fixtures/integration/without-raw/master.js create mode 100644 test/fixtures/integration/without-raw/master.m3u8 create mode 100644 test/fixtures/integration/without-raw/media.js create mode 100644 test/fixtures/integration/without-raw/media.m3u8 create mode 100644 test/fixtures/integration/without-raw/mediaSequence.js create mode 100644 test/fixtures/integration/without-raw/mediaSequence.m3u8 create mode 100644 test/fixtures/integration/without-raw/missingEndlist.js create mode 100644 test/fixtures/integration/without-raw/missingEndlist.m3u8 create mode 100644 test/fixtures/integration/without-raw/missingExtinf.js create mode 100644 test/fixtures/integration/without-raw/missingExtinf.m3u8 create mode 100644 test/fixtures/integration/without-raw/missingMediaSequence.js create mode 100644 test/fixtures/integration/without-raw/missingMediaSequence.m3u8 create mode 100644 test/fixtures/integration/without-raw/missingSegmentDuration.js create mode 100644 test/fixtures/integration/without-raw/missingSegmentDuration.m3u8 create mode 100644 test/fixtures/integration/without-raw/multipleAudioGroups.js create mode 100644 test/fixtures/integration/without-raw/multipleAudioGroups.m3u8 create mode 100644 test/fixtures/integration/without-raw/multipleAudioGroupsCombinedMain.js create mode 100644 test/fixtures/integration/without-raw/multipleAudioGroupsCombinedMain.m3u8 create mode 100644 test/fixtures/integration/without-raw/multipleTargetDurations.js create mode 100644 test/fixtures/integration/without-raw/multipleTargetDurations.m3u8 create mode 100644 test/fixtures/integration/without-raw/multipleVideo.js create mode 100644 test/fixtures/integration/without-raw/multipleVideo.m3u8 create mode 100644 test/fixtures/integration/without-raw/negativeMediaSequence.js create mode 100644 test/fixtures/integration/without-raw/negativeMediaSequence.m3u8 create mode 100644 test/fixtures/integration/without-raw/playlist.js create mode 100644 test/fixtures/integration/without-raw/playlist.m3u8 create mode 100644 test/fixtures/integration/without-raw/playlistMediaSequenceHigher.js create mode 100644 test/fixtures/integration/without-raw/playlistMediaSequenceHigher.m3u8 create mode 100644 test/fixtures/integration/without-raw/start.js create mode 100644 test/fixtures/integration/without-raw/start.m3u8 create mode 100644 test/fixtures/integration/without-raw/streamInfInvalid.js create mode 100644 test/fixtures/integration/without-raw/streamInfInvalid.m3u8 create mode 100644 test/fixtures/integration/without-raw/twoMediaSequences.js create mode 100644 test/fixtures/integration/without-raw/twoMediaSequences.m3u8 create mode 100644 test/fixtures/integration/without-raw/versionInvalid.js create mode 100644 test/fixtures/integration/without-raw/versionInvalid.m3u8 create mode 100644 test/fixtures/integration/without-raw/whiteSpace.js create mode 100644 test/fixtures/integration/without-raw/whiteSpace.m3u8 create mode 100644 test/fixtures/integration/without-raw/zeroDuration.js create mode 100644 test/fixtures/integration/without-raw/zeroDuration.m3u8 diff --git a/scripts/rollup.config.js b/scripts/rollup.config.js index 3fbc276..3ee1b7a 100644 --- a/scripts/rollup.config.js +++ b/scripts/rollup.config.js @@ -22,8 +22,10 @@ const options = { }); defaults.dataFiles = dataFiles({ - expecteds: {include: 'test/fixtures/integration/*.js', transform: 'js', extensions: false}, - manifests: {include: 'test/fixtures/integration/*.m3u8', transform: 'string', extensions: false} + expecteds: {include: 'test/fixtures/integration/without-raw/*.js', transform: 'js', extensions: false}, + manifests: {include: 'test/fixtures/integration/without-raw/*.m3u8', transform: 'string', extensions: false}, + expectedsWithRaw: {include: 'test/fixtures/integration/with-raw/*.js', transform: 'js', extensions: false}, + manifestsWithRaw: {include: 'test/fixtures/integration/with-raw/*.m3u8', transform: 'string', extensions: false} }); return defaults; diff --git a/src/parse-stream.js b/src/parse-stream.js index 11178b3..1c8ce2d 100644 --- a/src/parse-stream.js +++ b/src/parse-stream.js @@ -91,10 +91,11 @@ const parseAttributes = function(attributes) { * @extends Stream */ export default class ParseStream extends Stream { - constructor() { + constructor(returnRaw = false) { super(); this.customParsers = []; this.tagMappers = []; + this.returnRaw = returnRaw; } /** @@ -119,7 +120,7 @@ export default class ParseStream extends Stream { this.trigger('data', { type: 'uri', uri: line, - raw: line + raw: this.returnRaw ? line : undefined }); return; } @@ -148,7 +149,7 @@ export default class ParseStream extends Stream { this.trigger('data', { type: 'comment', text: newLine.slice(1), - raw: newLine + raw: this.returnRaw ? newLine : undefined }); return; } @@ -163,7 +164,7 @@ export default class ParseStream extends Stream { this.trigger('data', { type: 'tag', tagType: 'm3u', - raw: newLine + raw: this.returnRaw ? newLine : undefined }); return; } @@ -172,7 +173,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'inf', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.duration = parseFloat(match[1]); @@ -188,7 +189,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'targetduration', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.duration = parseInt(match[1], 10); @@ -201,7 +202,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'version', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.version = parseInt(match[1], 10); @@ -214,7 +215,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'media-sequence', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.number = parseInt(match[1], 10); @@ -227,7 +228,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'discontinuity-sequence', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.number = parseInt(match[1], 10); @@ -240,7 +241,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'playlist-type', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.playlistType = match[1]; @@ -253,7 +254,7 @@ export default class ParseStream extends Stream { event = Object.assign(parseByterange(match[1]), { type: 'tag', tagType: 'byterange', - raw: newLine + raw: this.returnRaw ? newLine : undefined }); this.trigger('data', event); return; @@ -263,7 +264,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'allow-cache', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.allowed = !(/NO/).test(match[1]); @@ -276,7 +277,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'map', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { @@ -298,7 +299,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'stream-inf', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.attributes = parseAttributes(match[1]); @@ -330,7 +331,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'media', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.attributes = parseAttributes(match[1]); @@ -343,7 +344,7 @@ export default class ParseStream extends Stream { this.trigger('data', { type: 'tag', tagType: 'endlist', - raw: newLine + raw: this.returnRaw ? newLine : undefined }); return; } @@ -352,7 +353,7 @@ export default class ParseStream extends Stream { this.trigger('data', { type: 'tag', tagType: 'discontinuity', - raw: newLine + raw: this.returnRaw ? newLine : undefined }); return; } @@ -361,7 +362,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'program-date-time', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.dateTimeString = match[1]; @@ -375,7 +376,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'key', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.attributes = parseAttributes(match[1]); @@ -401,7 +402,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'start', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.attributes = parseAttributes(match[1]); @@ -417,7 +418,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'cue-out-cont', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.data = match[1]; @@ -432,7 +433,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'cue-out', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.data = match[1]; @@ -447,7 +448,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'cue-in', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; if (match[1]) { event.data = match[1]; @@ -462,7 +463,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'skip', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; event.attributes = parseAttributes(match[1]); @@ -483,7 +484,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'part', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; event.attributes = parseAttributes(match[1]); ['DURATION'].forEach(function(key) { @@ -510,7 +511,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'server-control', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; event.attributes = parseAttributes(match[1]); ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function(key) { @@ -533,7 +534,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'part-inf', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; event.attributes = parseAttributes(match[1]); ['PART-TARGET'].forEach(function(key) { @@ -551,7 +552,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'preload-hint', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; event.attributes = parseAttributes(match[1]); ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function(key) { @@ -575,7 +576,7 @@ export default class ParseStream extends Stream { event = { type: 'tag', tagType: 'rendition-report', - raw: newLine + raw: this.returnRaw ? newLine : undefined }; event.attributes = parseAttributes(match[1]); ['LAST-MSN', 'LAST-PART'].forEach(function(key) { @@ -592,7 +593,7 @@ export default class ParseStream extends Stream { this.trigger('data', { type: 'tag', data: newLine.slice(4), - raw: newLine + raw: this.returnRaw ? newLine : undefined }); }); } diff --git a/src/parser.js b/src/parser.js index 3b51d8a..0d15270 100644 --- a/src/parser.js +++ b/src/parser.js @@ -91,17 +91,18 @@ const setHoldBack = function(manifest) { * @extends Stream */ export default class Parser extends Stream { - constructor() { + constructor(returnRaw = false) { super(); this.lineStream = new LineStream(); - this.parseStream = new ParseStream(); + this.parseStream = new ParseStream(returnRaw); this.lineStream.pipe(this.parseStream); + this.returnRaw = returnRaw; /* eslint-disable consistent-this */ const self = this; /* eslint-enable consistent-this */ const uris = []; - let currentUri = { raw: [] }; + let currentUri = { raw: this.returnRaw ? [] : undefined }; // if specified, the active EXT-X-MAP definition let currentMap; // if specified, the active decryption key @@ -178,7 +179,10 @@ export default class Parser extends Stream { } }, byterange() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } + const byterange = {}; if ('length' in entry) { @@ -209,7 +213,9 @@ export default class Parser extends Stream { this.manifest.endList = true; }, inf() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } if (!('mediaSequence' in this.manifest)) { this.manifest.mediaSequence = 0; this.trigger('info', { @@ -381,7 +387,10 @@ export default class Parser extends Stream { } }, 'stream-inf'() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } + this.manifest.playlists = uris; this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups; @@ -448,13 +457,18 @@ export default class Parser extends Stream { mediaGroup[entry.attributes.NAME] = rendition; }, discontinuity() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } + currentTimeline += 1; currentUri.discontinuity = true; this.manifest.discontinuityStarts.push(uris.length); }, 'program-date-time'() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } if (typeof this.manifest.dateTimeString === 'undefined') { // PROGRAM-DATE-TIME is a media-segment tag, but for backwards // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag @@ -491,15 +505,21 @@ export default class Parser extends Stream { }; }, 'cue-out'() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } currentUri.cueOut = entry.data; }, 'cue-out-cont'() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } currentUri.cueOutCont = entry.data; }, 'cue-in'() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } currentUri.cueIn = entry.data; }, 'skip'() { @@ -512,7 +532,9 @@ export default class Parser extends Stream { ); }, 'part'() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } hasParts = true; // parts are always specifed before a segment const segmentIndex = this.manifest.segments.length; @@ -564,7 +586,9 @@ export default class Parser extends Stream { } }, 'preload-hint'() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } // parts are always specifed before a segment const segmentIndex = this.manifest.segments.length; const hint = camelCaseKeys(entry.attributes); @@ -645,7 +669,9 @@ export default class Parser extends Stream { })[entry.tagType] || noop).call(self); }, uri() { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } currentUri.uri = entry.uri; uris.push(currentUri); @@ -670,7 +696,7 @@ export default class Parser extends Stream { lastPartByterangeEnd = 0; // prepare for the next URI - currentUri = { raw: [] }; + currentUri = { raw: this.returnRaw ? [] : undefined }; }, comment() { // comments are not important for playback @@ -678,7 +704,9 @@ export default class Parser extends Stream { custom() { // if this is segment-level data attach the output to the segment if (entry.segment) { - currentUri.raw.push(entry.raw); + if (this.returnRaw) { + currentUri.raw.push(entry.raw); + } currentUri.custom = currentUri.custom || {}; currentUri.custom[entry.customType] = entry.data; // if this is manifest-level data attach to the top level manifest object diff --git a/test/fixtures/integration/absoluteUris.js b/test/fixtures/integration/with-raw/absoluteUris.js similarity index 100% rename from test/fixtures/integration/absoluteUris.js rename to test/fixtures/integration/with-raw/absoluteUris.js diff --git a/test/fixtures/integration/absoluteUris.m3u8 b/test/fixtures/integration/with-raw/absoluteUris.m3u8 similarity index 100% rename from test/fixtures/integration/absoluteUris.m3u8 rename to test/fixtures/integration/with-raw/absoluteUris.m3u8 diff --git a/test/fixtures/integration/allowCache.js b/test/fixtures/integration/with-raw/allowCache.js similarity index 100% rename from test/fixtures/integration/allowCache.js rename to test/fixtures/integration/with-raw/allowCache.js diff --git a/test/fixtures/integration/allowCache.m3u8 b/test/fixtures/integration/with-raw/allowCache.m3u8 similarity index 100% rename from test/fixtures/integration/allowCache.m3u8 rename to test/fixtures/integration/with-raw/allowCache.m3u8 diff --git a/test/fixtures/integration/allowCacheInvalid.js b/test/fixtures/integration/with-raw/allowCacheInvalid.js similarity index 100% rename from test/fixtures/integration/allowCacheInvalid.js rename to test/fixtures/integration/with-raw/allowCacheInvalid.js diff --git a/test/fixtures/integration/allowCacheInvalid.m3u8 b/test/fixtures/integration/with-raw/allowCacheInvalid.m3u8 similarity index 100% rename from test/fixtures/integration/allowCacheInvalid.m3u8 rename to test/fixtures/integration/with-raw/allowCacheInvalid.m3u8 diff --git a/test/fixtures/integration/alternateAudio.js b/test/fixtures/integration/with-raw/alternateAudio.js similarity index 100% rename from test/fixtures/integration/alternateAudio.js rename to test/fixtures/integration/with-raw/alternateAudio.js diff --git a/test/fixtures/integration/alternateAudio.m3u8 b/test/fixtures/integration/with-raw/alternateAudio.m3u8 similarity index 100% rename from test/fixtures/integration/alternateAudio.m3u8 rename to test/fixtures/integration/with-raw/alternateAudio.m3u8 diff --git a/test/fixtures/integration/alternateVideo.js b/test/fixtures/integration/with-raw/alternateVideo.js similarity index 100% rename from test/fixtures/integration/alternateVideo.js rename to test/fixtures/integration/with-raw/alternateVideo.js diff --git a/test/fixtures/integration/alternateVideo.m3u8 b/test/fixtures/integration/with-raw/alternateVideo.m3u8 similarity index 100% rename from test/fixtures/integration/alternateVideo.m3u8 rename to test/fixtures/integration/with-raw/alternateVideo.m3u8 diff --git a/test/fixtures/integration/brightcove.js b/test/fixtures/integration/with-raw/brightcove.js similarity index 100% rename from test/fixtures/integration/brightcove.js rename to test/fixtures/integration/with-raw/brightcove.js diff --git a/test/fixtures/integration/brightcove.m3u8 b/test/fixtures/integration/with-raw/brightcove.m3u8 similarity index 100% rename from test/fixtures/integration/brightcove.m3u8 rename to test/fixtures/integration/with-raw/brightcove.m3u8 diff --git a/test/fixtures/integration/byteRange.js b/test/fixtures/integration/with-raw/byteRange.js similarity index 100% rename from test/fixtures/integration/byteRange.js rename to test/fixtures/integration/with-raw/byteRange.js diff --git a/test/fixtures/integration/byteRange.m3u8 b/test/fixtures/integration/with-raw/byteRange.m3u8 similarity index 100% rename from test/fixtures/integration/byteRange.m3u8 rename to test/fixtures/integration/with-raw/byteRange.m3u8 diff --git a/test/fixtures/integration/dateTime.js b/test/fixtures/integration/with-raw/dateTime.js similarity index 100% rename from test/fixtures/integration/dateTime.js rename to test/fixtures/integration/with-raw/dateTime.js diff --git a/test/fixtures/integration/dateTime.m3u8 b/test/fixtures/integration/with-raw/dateTime.m3u8 similarity index 100% rename from test/fixtures/integration/dateTime.m3u8 rename to test/fixtures/integration/with-raw/dateTime.m3u8 diff --git a/test/fixtures/integration/diff-init-key.js b/test/fixtures/integration/with-raw/diff-init-key.js similarity index 100% rename from test/fixtures/integration/diff-init-key.js rename to test/fixtures/integration/with-raw/diff-init-key.js diff --git a/test/fixtures/integration/diff-init-key.m3u8 b/test/fixtures/integration/with-raw/diff-init-key.m3u8 similarity index 100% rename from test/fixtures/integration/diff-init-key.m3u8 rename to test/fixtures/integration/with-raw/diff-init-key.m3u8 diff --git a/test/fixtures/integration/disallowCache.js b/test/fixtures/integration/with-raw/disallowCache.js similarity index 100% rename from test/fixtures/integration/disallowCache.js rename to test/fixtures/integration/with-raw/disallowCache.js diff --git a/test/fixtures/integration/disallowCache.m3u8 b/test/fixtures/integration/with-raw/disallowCache.m3u8 similarity index 100% rename from test/fixtures/integration/disallowCache.m3u8 rename to test/fixtures/integration/with-raw/disallowCache.m3u8 diff --git a/test/fixtures/integration/disc-sequence.js b/test/fixtures/integration/with-raw/disc-sequence.js similarity index 100% rename from test/fixtures/integration/disc-sequence.js rename to test/fixtures/integration/with-raw/disc-sequence.js diff --git a/test/fixtures/integration/disc-sequence.m3u8 b/test/fixtures/integration/with-raw/disc-sequence.m3u8 similarity index 100% rename from test/fixtures/integration/disc-sequence.m3u8 rename to test/fixtures/integration/with-raw/disc-sequence.m3u8 diff --git a/test/fixtures/integration/discontinuity.js b/test/fixtures/integration/with-raw/discontinuity.js similarity index 100% rename from test/fixtures/integration/discontinuity.js rename to test/fixtures/integration/with-raw/discontinuity.js diff --git a/test/fixtures/integration/discontinuity.m3u8 b/test/fixtures/integration/with-raw/discontinuity.m3u8 similarity index 100% rename from test/fixtures/integration/discontinuity.m3u8 rename to test/fixtures/integration/with-raw/discontinuity.m3u8 diff --git a/test/fixtures/integration/domainUris.js b/test/fixtures/integration/with-raw/domainUris.js similarity index 100% rename from test/fixtures/integration/domainUris.js rename to test/fixtures/integration/with-raw/domainUris.js diff --git a/test/fixtures/integration/domainUris.m3u8 b/test/fixtures/integration/with-raw/domainUris.m3u8 similarity index 100% rename from test/fixtures/integration/domainUris.m3u8 rename to test/fixtures/integration/with-raw/domainUris.m3u8 diff --git a/test/fixtures/integration/empty.js b/test/fixtures/integration/with-raw/empty.js similarity index 100% rename from test/fixtures/integration/empty.js rename to test/fixtures/integration/with-raw/empty.js diff --git a/test/fixtures/integration/empty.m3u8 b/test/fixtures/integration/with-raw/empty.m3u8 similarity index 100% rename from test/fixtures/integration/empty.m3u8 rename to test/fixtures/integration/with-raw/empty.m3u8 diff --git a/test/fixtures/integration/emptyAllowCache.js b/test/fixtures/integration/with-raw/emptyAllowCache.js similarity index 100% rename from test/fixtures/integration/emptyAllowCache.js rename to test/fixtures/integration/with-raw/emptyAllowCache.js diff --git a/test/fixtures/integration/emptyAllowCache.m3u8 b/test/fixtures/integration/with-raw/emptyAllowCache.m3u8 similarity index 100% rename from test/fixtures/integration/emptyAllowCache.m3u8 rename to test/fixtures/integration/with-raw/emptyAllowCache.m3u8 diff --git a/test/fixtures/integration/emptyMediaSequence.js b/test/fixtures/integration/with-raw/emptyMediaSequence.js similarity index 100% rename from test/fixtures/integration/emptyMediaSequence.js rename to test/fixtures/integration/with-raw/emptyMediaSequence.js diff --git a/test/fixtures/integration/emptyMediaSequence.m3u8 b/test/fixtures/integration/with-raw/emptyMediaSequence.m3u8 similarity index 100% rename from test/fixtures/integration/emptyMediaSequence.m3u8 rename to test/fixtures/integration/with-raw/emptyMediaSequence.m3u8 diff --git a/test/fixtures/integration/emptyPlaylistType.js b/test/fixtures/integration/with-raw/emptyPlaylistType.js similarity index 100% rename from test/fixtures/integration/emptyPlaylistType.js rename to test/fixtures/integration/with-raw/emptyPlaylistType.js diff --git a/test/fixtures/integration/emptyPlaylistType.m3u8 b/test/fixtures/integration/with-raw/emptyPlaylistType.m3u8 similarity index 100% rename from test/fixtures/integration/emptyPlaylistType.m3u8 rename to test/fixtures/integration/with-raw/emptyPlaylistType.m3u8 diff --git a/test/fixtures/integration/emptyTargetDuration.js b/test/fixtures/integration/with-raw/emptyTargetDuration.js similarity index 100% rename from test/fixtures/integration/emptyTargetDuration.js rename to test/fixtures/integration/with-raw/emptyTargetDuration.js diff --git a/test/fixtures/integration/emptyTargetDuration.m3u8 b/test/fixtures/integration/with-raw/emptyTargetDuration.m3u8 similarity index 100% rename from test/fixtures/integration/emptyTargetDuration.m3u8 rename to test/fixtures/integration/with-raw/emptyTargetDuration.m3u8 diff --git a/test/fixtures/integration/encrypted.js b/test/fixtures/integration/with-raw/encrypted.js similarity index 100% rename from test/fixtures/integration/encrypted.js rename to test/fixtures/integration/with-raw/encrypted.js diff --git a/test/fixtures/integration/encrypted.m3u8 b/test/fixtures/integration/with-raw/encrypted.m3u8 similarity index 100% rename from test/fixtures/integration/encrypted.m3u8 rename to test/fixtures/integration/with-raw/encrypted.m3u8 diff --git a/test/fixtures/integration/event.js b/test/fixtures/integration/with-raw/event.js similarity index 100% rename from test/fixtures/integration/event.js rename to test/fixtures/integration/with-raw/event.js diff --git a/test/fixtures/integration/event.m3u8 b/test/fixtures/integration/with-raw/event.m3u8 similarity index 100% rename from test/fixtures/integration/event.m3u8 rename to test/fixtures/integration/with-raw/event.m3u8 diff --git a/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js b/test/fixtures/integration/with-raw/extXPlaylistTypeInvalidPlaylist.js similarity index 100% rename from test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js rename to test/fixtures/integration/with-raw/extXPlaylistTypeInvalidPlaylist.js diff --git a/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.m3u8 b/test/fixtures/integration/with-raw/extXPlaylistTypeInvalidPlaylist.m3u8 similarity index 100% rename from test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.m3u8 rename to test/fixtures/integration/with-raw/extXPlaylistTypeInvalidPlaylist.m3u8 diff --git a/test/fixtures/integration/extinf.js b/test/fixtures/integration/with-raw/extinf.js similarity index 100% rename from test/fixtures/integration/extinf.js rename to test/fixtures/integration/with-raw/extinf.js diff --git a/test/fixtures/integration/extinf.m3u8 b/test/fixtures/integration/with-raw/extinf.m3u8 similarity index 100% rename from test/fixtures/integration/extinf.m3u8 rename to test/fixtures/integration/with-raw/extinf.m3u8 diff --git a/test/fixtures/integration/fmp4.js b/test/fixtures/integration/with-raw/fmp4.js similarity index 100% rename from test/fixtures/integration/fmp4.js rename to test/fixtures/integration/with-raw/fmp4.js diff --git a/test/fixtures/integration/fmp4.m3u8 b/test/fixtures/integration/with-raw/fmp4.m3u8 similarity index 100% rename from test/fixtures/integration/fmp4.m3u8 rename to test/fixtures/integration/with-raw/fmp4.m3u8 diff --git a/test/fixtures/integration/headerOnly.js b/test/fixtures/integration/with-raw/headerOnly.js similarity index 100% rename from test/fixtures/integration/headerOnly.js rename to test/fixtures/integration/with-raw/headerOnly.js diff --git a/test/fixtures/integration/headerOnly.m3u8 b/test/fixtures/integration/with-raw/headerOnly.m3u8 similarity index 100% rename from test/fixtures/integration/headerOnly.m3u8 rename to test/fixtures/integration/with-raw/headerOnly.m3u8 diff --git a/test/fixtures/integration/invalidAllowCache.js b/test/fixtures/integration/with-raw/invalidAllowCache.js similarity index 100% rename from test/fixtures/integration/invalidAllowCache.js rename to test/fixtures/integration/with-raw/invalidAllowCache.js diff --git a/test/fixtures/integration/invalidAllowCache.m3u8 b/test/fixtures/integration/with-raw/invalidAllowCache.m3u8 similarity index 100% rename from test/fixtures/integration/invalidAllowCache.m3u8 rename to test/fixtures/integration/with-raw/invalidAllowCache.m3u8 diff --git a/test/fixtures/integration/invalidMediaSequence.js b/test/fixtures/integration/with-raw/invalidMediaSequence.js similarity index 100% rename from test/fixtures/integration/invalidMediaSequence.js rename to test/fixtures/integration/with-raw/invalidMediaSequence.js diff --git a/test/fixtures/integration/invalidMediaSequence.m3u8 b/test/fixtures/integration/with-raw/invalidMediaSequence.m3u8 similarity index 100% rename from test/fixtures/integration/invalidMediaSequence.m3u8 rename to test/fixtures/integration/with-raw/invalidMediaSequence.m3u8 diff --git a/test/fixtures/integration/invalidPlaylistType.js b/test/fixtures/integration/with-raw/invalidPlaylistType.js similarity index 100% rename from test/fixtures/integration/invalidPlaylistType.js rename to test/fixtures/integration/with-raw/invalidPlaylistType.js diff --git a/test/fixtures/integration/invalidPlaylistType.m3u8 b/test/fixtures/integration/with-raw/invalidPlaylistType.m3u8 similarity index 100% rename from test/fixtures/integration/invalidPlaylistType.m3u8 rename to test/fixtures/integration/with-raw/invalidPlaylistType.m3u8 diff --git a/test/fixtures/integration/invalidTargetDuration.js b/test/fixtures/integration/with-raw/invalidTargetDuration.js similarity index 100% rename from test/fixtures/integration/invalidTargetDuration.js rename to test/fixtures/integration/with-raw/invalidTargetDuration.js diff --git a/test/fixtures/integration/invalidTargetDuration.m3u8 b/test/fixtures/integration/with-raw/invalidTargetDuration.m3u8 similarity index 100% rename from test/fixtures/integration/invalidTargetDuration.m3u8 rename to test/fixtures/integration/with-raw/invalidTargetDuration.m3u8 diff --git a/test/fixtures/integration/liveMissingSegmentDuration.js b/test/fixtures/integration/with-raw/liveMissingSegmentDuration.js similarity index 100% rename from test/fixtures/integration/liveMissingSegmentDuration.js rename to test/fixtures/integration/with-raw/liveMissingSegmentDuration.js diff --git a/test/fixtures/integration/liveMissingSegmentDuration.m3u8 b/test/fixtures/integration/with-raw/liveMissingSegmentDuration.m3u8 similarity index 100% rename from test/fixtures/integration/liveMissingSegmentDuration.m3u8 rename to test/fixtures/integration/with-raw/liveMissingSegmentDuration.m3u8 diff --git a/test/fixtures/integration/liveStart30sBefore.js b/test/fixtures/integration/with-raw/liveStart30sBefore.js similarity index 100% rename from test/fixtures/integration/liveStart30sBefore.js rename to test/fixtures/integration/with-raw/liveStart30sBefore.js diff --git a/test/fixtures/integration/liveStart30sBefore.m3u8 b/test/fixtures/integration/with-raw/liveStart30sBefore.m3u8 similarity index 100% rename from test/fixtures/integration/liveStart30sBefore.m3u8 rename to test/fixtures/integration/with-raw/liveStart30sBefore.m3u8 diff --git a/test/fixtures/integration/llhls-byte-range.js b/test/fixtures/integration/with-raw/llhls-byte-range.js similarity index 100% rename from test/fixtures/integration/llhls-byte-range.js rename to test/fixtures/integration/with-raw/llhls-byte-range.js diff --git a/test/fixtures/integration/llhls-byte-range.m3u8 b/test/fixtures/integration/with-raw/llhls-byte-range.m3u8 similarity index 100% rename from test/fixtures/integration/llhls-byte-range.m3u8 rename to test/fixtures/integration/with-raw/llhls-byte-range.m3u8 diff --git a/test/fixtures/integration/llhls-delta-byte-range.js b/test/fixtures/integration/with-raw/llhls-delta-byte-range.js similarity index 100% rename from test/fixtures/integration/llhls-delta-byte-range.js rename to test/fixtures/integration/with-raw/llhls-delta-byte-range.js diff --git a/test/fixtures/integration/llhls-delta-byte-range.m3u8 b/test/fixtures/integration/with-raw/llhls-delta-byte-range.m3u8 similarity index 100% rename from test/fixtures/integration/llhls-delta-byte-range.m3u8 rename to test/fixtures/integration/with-raw/llhls-delta-byte-range.m3u8 diff --git a/test/fixtures/integration/llhls.js b/test/fixtures/integration/with-raw/llhls.js similarity index 100% rename from test/fixtures/integration/llhls.js rename to test/fixtures/integration/with-raw/llhls.js diff --git a/test/fixtures/integration/llhls.m3u8 b/test/fixtures/integration/with-raw/llhls.m3u8 similarity index 100% rename from test/fixtures/integration/llhls.m3u8 rename to test/fixtures/integration/with-raw/llhls.m3u8 diff --git a/test/fixtures/integration/llhlsDelta.js b/test/fixtures/integration/with-raw/llhlsDelta.js similarity index 100% rename from test/fixtures/integration/llhlsDelta.js rename to test/fixtures/integration/with-raw/llhlsDelta.js diff --git a/test/fixtures/integration/llhlsDelta.m3u8 b/test/fixtures/integration/with-raw/llhlsDelta.m3u8 similarity index 100% rename from test/fixtures/integration/llhlsDelta.m3u8 rename to test/fixtures/integration/with-raw/llhlsDelta.m3u8 diff --git a/test/fixtures/integration/manifestExtTTargetdurationNegative.js b/test/fixtures/integration/with-raw/manifestExtTTargetdurationNegative.js similarity index 100% rename from test/fixtures/integration/manifestExtTTargetdurationNegative.js rename to test/fixtures/integration/with-raw/manifestExtTTargetdurationNegative.js diff --git a/test/fixtures/integration/manifestExtTTargetdurationNegative.m3u8 b/test/fixtures/integration/with-raw/manifestExtTTargetdurationNegative.m3u8 similarity index 100% rename from test/fixtures/integration/manifestExtTTargetdurationNegative.m3u8 rename to test/fixtures/integration/with-raw/manifestExtTTargetdurationNegative.m3u8 diff --git a/test/fixtures/integration/manifestExtXEndlistEarly.js b/test/fixtures/integration/with-raw/manifestExtXEndlistEarly.js similarity index 100% rename from test/fixtures/integration/manifestExtXEndlistEarly.js rename to test/fixtures/integration/with-raw/manifestExtXEndlistEarly.js diff --git a/test/fixtures/integration/manifestExtXEndlistEarly.m3u8 b/test/fixtures/integration/with-raw/manifestExtXEndlistEarly.m3u8 similarity index 100% rename from test/fixtures/integration/manifestExtXEndlistEarly.m3u8 rename to test/fixtures/integration/with-raw/manifestExtXEndlistEarly.m3u8 diff --git a/test/fixtures/integration/manifestNoExtM3u.js b/test/fixtures/integration/with-raw/manifestNoExtM3u.js similarity index 100% rename from test/fixtures/integration/manifestNoExtM3u.js rename to test/fixtures/integration/with-raw/manifestNoExtM3u.js diff --git a/test/fixtures/integration/manifestNoExtM3u.m3u8 b/test/fixtures/integration/with-raw/manifestNoExtM3u.m3u8 similarity index 100% rename from test/fixtures/integration/manifestNoExtM3u.m3u8 rename to test/fixtures/integration/with-raw/manifestNoExtM3u.m3u8 diff --git a/test/fixtures/integration/master-fmp4.js b/test/fixtures/integration/with-raw/master-fmp4.js similarity index 100% rename from test/fixtures/integration/master-fmp4.js rename to test/fixtures/integration/with-raw/master-fmp4.js diff --git a/test/fixtures/integration/master-fmp4.m3u8 b/test/fixtures/integration/with-raw/master-fmp4.m3u8 similarity index 100% rename from test/fixtures/integration/master-fmp4.m3u8 rename to test/fixtures/integration/with-raw/master-fmp4.m3u8 diff --git a/test/fixtures/integration/master.js b/test/fixtures/integration/with-raw/master.js similarity index 100% rename from test/fixtures/integration/master.js rename to test/fixtures/integration/with-raw/master.js diff --git a/test/fixtures/integration/master.m3u8 b/test/fixtures/integration/with-raw/master.m3u8 similarity index 100% rename from test/fixtures/integration/master.m3u8 rename to test/fixtures/integration/with-raw/master.m3u8 diff --git a/test/fixtures/integration/media.js b/test/fixtures/integration/with-raw/media.js similarity index 100% rename from test/fixtures/integration/media.js rename to test/fixtures/integration/with-raw/media.js diff --git a/test/fixtures/integration/media.m3u8 b/test/fixtures/integration/with-raw/media.m3u8 similarity index 100% rename from test/fixtures/integration/media.m3u8 rename to test/fixtures/integration/with-raw/media.m3u8 diff --git a/test/fixtures/integration/mediaSequence.js b/test/fixtures/integration/with-raw/mediaSequence.js similarity index 100% rename from test/fixtures/integration/mediaSequence.js rename to test/fixtures/integration/with-raw/mediaSequence.js diff --git a/test/fixtures/integration/mediaSequence.m3u8 b/test/fixtures/integration/with-raw/mediaSequence.m3u8 similarity index 100% rename from test/fixtures/integration/mediaSequence.m3u8 rename to test/fixtures/integration/with-raw/mediaSequence.m3u8 diff --git a/test/fixtures/integration/missingEndlist.js b/test/fixtures/integration/with-raw/missingEndlist.js similarity index 100% rename from test/fixtures/integration/missingEndlist.js rename to test/fixtures/integration/with-raw/missingEndlist.js diff --git a/test/fixtures/integration/missingEndlist.m3u8 b/test/fixtures/integration/with-raw/missingEndlist.m3u8 similarity index 100% rename from test/fixtures/integration/missingEndlist.m3u8 rename to test/fixtures/integration/with-raw/missingEndlist.m3u8 diff --git a/test/fixtures/integration/missingExtinf.js b/test/fixtures/integration/with-raw/missingExtinf.js similarity index 100% rename from test/fixtures/integration/missingExtinf.js rename to test/fixtures/integration/with-raw/missingExtinf.js diff --git a/test/fixtures/integration/missingExtinf.m3u8 b/test/fixtures/integration/with-raw/missingExtinf.m3u8 similarity index 100% rename from test/fixtures/integration/missingExtinf.m3u8 rename to test/fixtures/integration/with-raw/missingExtinf.m3u8 diff --git a/test/fixtures/integration/missingMediaSequence.js b/test/fixtures/integration/with-raw/missingMediaSequence.js similarity index 100% rename from test/fixtures/integration/missingMediaSequence.js rename to test/fixtures/integration/with-raw/missingMediaSequence.js diff --git a/test/fixtures/integration/missingMediaSequence.m3u8 b/test/fixtures/integration/with-raw/missingMediaSequence.m3u8 similarity index 100% rename from test/fixtures/integration/missingMediaSequence.m3u8 rename to test/fixtures/integration/with-raw/missingMediaSequence.m3u8 diff --git a/test/fixtures/integration/missingSegmentDuration.js b/test/fixtures/integration/with-raw/missingSegmentDuration.js similarity index 100% rename from test/fixtures/integration/missingSegmentDuration.js rename to test/fixtures/integration/with-raw/missingSegmentDuration.js diff --git a/test/fixtures/integration/missingSegmentDuration.m3u8 b/test/fixtures/integration/with-raw/missingSegmentDuration.m3u8 similarity index 100% rename from test/fixtures/integration/missingSegmentDuration.m3u8 rename to test/fixtures/integration/with-raw/missingSegmentDuration.m3u8 diff --git a/test/fixtures/integration/multipleAudioGroups.js b/test/fixtures/integration/with-raw/multipleAudioGroups.js similarity index 100% rename from test/fixtures/integration/multipleAudioGroups.js rename to test/fixtures/integration/with-raw/multipleAudioGroups.js diff --git a/test/fixtures/integration/multipleAudioGroups.m3u8 b/test/fixtures/integration/with-raw/multipleAudioGroups.m3u8 similarity index 100% rename from test/fixtures/integration/multipleAudioGroups.m3u8 rename to test/fixtures/integration/with-raw/multipleAudioGroups.m3u8 diff --git a/test/fixtures/integration/multipleAudioGroupsCombinedMain.js b/test/fixtures/integration/with-raw/multipleAudioGroupsCombinedMain.js similarity index 100% rename from test/fixtures/integration/multipleAudioGroupsCombinedMain.js rename to test/fixtures/integration/with-raw/multipleAudioGroupsCombinedMain.js diff --git a/test/fixtures/integration/multipleAudioGroupsCombinedMain.m3u8 b/test/fixtures/integration/with-raw/multipleAudioGroupsCombinedMain.m3u8 similarity index 100% rename from test/fixtures/integration/multipleAudioGroupsCombinedMain.m3u8 rename to test/fixtures/integration/with-raw/multipleAudioGroupsCombinedMain.m3u8 diff --git a/test/fixtures/integration/multipleTargetDurations.js b/test/fixtures/integration/with-raw/multipleTargetDurations.js similarity index 100% rename from test/fixtures/integration/multipleTargetDurations.js rename to test/fixtures/integration/with-raw/multipleTargetDurations.js diff --git a/test/fixtures/integration/multipleTargetDurations.m3u8 b/test/fixtures/integration/with-raw/multipleTargetDurations.m3u8 similarity index 100% rename from test/fixtures/integration/multipleTargetDurations.m3u8 rename to test/fixtures/integration/with-raw/multipleTargetDurations.m3u8 diff --git a/test/fixtures/integration/multipleVideo.js b/test/fixtures/integration/with-raw/multipleVideo.js similarity index 100% rename from test/fixtures/integration/multipleVideo.js rename to test/fixtures/integration/with-raw/multipleVideo.js diff --git a/test/fixtures/integration/multipleVideo.m3u8 b/test/fixtures/integration/with-raw/multipleVideo.m3u8 similarity index 100% rename from test/fixtures/integration/multipleVideo.m3u8 rename to test/fixtures/integration/with-raw/multipleVideo.m3u8 diff --git a/test/fixtures/integration/negativeMediaSequence.js b/test/fixtures/integration/with-raw/negativeMediaSequence.js similarity index 100% rename from test/fixtures/integration/negativeMediaSequence.js rename to test/fixtures/integration/with-raw/negativeMediaSequence.js diff --git a/test/fixtures/integration/negativeMediaSequence.m3u8 b/test/fixtures/integration/with-raw/negativeMediaSequence.m3u8 similarity index 100% rename from test/fixtures/integration/negativeMediaSequence.m3u8 rename to test/fixtures/integration/with-raw/negativeMediaSequence.m3u8 diff --git a/test/fixtures/integration/playlist.js b/test/fixtures/integration/with-raw/playlist.js similarity index 100% rename from test/fixtures/integration/playlist.js rename to test/fixtures/integration/with-raw/playlist.js diff --git a/test/fixtures/integration/playlist.m3u8 b/test/fixtures/integration/with-raw/playlist.m3u8 similarity index 100% rename from test/fixtures/integration/playlist.m3u8 rename to test/fixtures/integration/with-raw/playlist.m3u8 diff --git a/test/fixtures/integration/playlistMediaSequenceHigher.js b/test/fixtures/integration/with-raw/playlistMediaSequenceHigher.js similarity index 100% rename from test/fixtures/integration/playlistMediaSequenceHigher.js rename to test/fixtures/integration/with-raw/playlistMediaSequenceHigher.js diff --git a/test/fixtures/integration/playlistMediaSequenceHigher.m3u8 b/test/fixtures/integration/with-raw/playlistMediaSequenceHigher.m3u8 similarity index 100% rename from test/fixtures/integration/playlistMediaSequenceHigher.m3u8 rename to test/fixtures/integration/with-raw/playlistMediaSequenceHigher.m3u8 diff --git a/test/fixtures/integration/start.js b/test/fixtures/integration/with-raw/start.js similarity index 100% rename from test/fixtures/integration/start.js rename to test/fixtures/integration/with-raw/start.js diff --git a/test/fixtures/integration/start.m3u8 b/test/fixtures/integration/with-raw/start.m3u8 similarity index 100% rename from test/fixtures/integration/start.m3u8 rename to test/fixtures/integration/with-raw/start.m3u8 diff --git a/test/fixtures/integration/streamInfInvalid.js b/test/fixtures/integration/with-raw/streamInfInvalid.js similarity index 100% rename from test/fixtures/integration/streamInfInvalid.js rename to test/fixtures/integration/with-raw/streamInfInvalid.js diff --git a/test/fixtures/integration/streamInfInvalid.m3u8 b/test/fixtures/integration/with-raw/streamInfInvalid.m3u8 similarity index 100% rename from test/fixtures/integration/streamInfInvalid.m3u8 rename to test/fixtures/integration/with-raw/streamInfInvalid.m3u8 diff --git a/test/fixtures/integration/twoMediaSequences.js b/test/fixtures/integration/with-raw/twoMediaSequences.js similarity index 100% rename from test/fixtures/integration/twoMediaSequences.js rename to test/fixtures/integration/with-raw/twoMediaSequences.js diff --git a/test/fixtures/integration/twoMediaSequences.m3u8 b/test/fixtures/integration/with-raw/twoMediaSequences.m3u8 similarity index 100% rename from test/fixtures/integration/twoMediaSequences.m3u8 rename to test/fixtures/integration/with-raw/twoMediaSequences.m3u8 diff --git a/test/fixtures/integration/versionInvalid.js b/test/fixtures/integration/with-raw/versionInvalid.js similarity index 100% rename from test/fixtures/integration/versionInvalid.js rename to test/fixtures/integration/with-raw/versionInvalid.js diff --git a/test/fixtures/integration/versionInvalid.m3u8 b/test/fixtures/integration/with-raw/versionInvalid.m3u8 similarity index 100% rename from test/fixtures/integration/versionInvalid.m3u8 rename to test/fixtures/integration/with-raw/versionInvalid.m3u8 diff --git a/test/fixtures/integration/whiteSpace.js b/test/fixtures/integration/with-raw/whiteSpace.js similarity index 100% rename from test/fixtures/integration/whiteSpace.js rename to test/fixtures/integration/with-raw/whiteSpace.js diff --git a/test/fixtures/integration/whiteSpace.m3u8 b/test/fixtures/integration/with-raw/whiteSpace.m3u8 similarity index 100% rename from test/fixtures/integration/whiteSpace.m3u8 rename to test/fixtures/integration/with-raw/whiteSpace.m3u8 diff --git a/test/fixtures/integration/zeroDuration.js b/test/fixtures/integration/with-raw/zeroDuration.js similarity index 100% rename from test/fixtures/integration/zeroDuration.js rename to test/fixtures/integration/with-raw/zeroDuration.js diff --git a/test/fixtures/integration/zeroDuration.m3u8 b/test/fixtures/integration/with-raw/zeroDuration.m3u8 similarity index 100% rename from test/fixtures/integration/zeroDuration.m3u8 rename to test/fixtures/integration/with-raw/zeroDuration.m3u8 diff --git a/test/fixtures/integration/without-raw/absoluteUris.js b/test/fixtures/integration/without-raw/absoluteUris.js new file mode 100644 index 0000000..537b779 --- /dev/null +++ b/test/fixtures/integration/without-raw/absoluteUris.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'http://example.com/00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'https://example.com/00002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '//example.com/00003.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'http://example.com/00004.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/absoluteUris.m3u8 b/test/fixtures/integration/without-raw/absoluteUris.m3u8 new file mode 100644 index 0000000..6fbaf05 --- /dev/null +++ b/test/fixtures/integration/without-raw/absoluteUris.m3u8 @@ -0,0 +1,12 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-TARGETDURATION:10 +#EXTINF:10, +http://example.com/00001.ts +#EXTINF:10, +https://example.com/00002.ts +#EXTINF:10, +//example.com/00003.ts +#EXTINF:10, +http://example.com/00004.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/allowCache.js b/test/fixtures/integration/without-raw/allowCache.js new file mode 100644 index 0000000..141d1a2 --- /dev/null +++ b/test/fixtures/integration/without-raw/allowCache.js @@ -0,0 +1,182 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + byterange: { + length: 522828, + offset: 0 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 587500, + offset: 522828 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 713084, + offset: 1110328 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 476580, + offset: 1823412 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 535612, + offset: 2299992 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 207176, + offset: 2835604 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 455900, + offset: 3042780 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 657248, + offset: 3498680 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 571708, + offset: 4155928 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 485040, + offset: 4727636 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 709136, + offset: 5212676 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 730004, + offset: 5921812 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 456276, + offset: 6651816 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 468684, + offset: 7108092 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 444996, + offset: 7576776 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 331444, + offset: 8021772 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 44556, + offset: 8353216 + }, + duration: 1.4167, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 4 +}; diff --git a/test/fixtures/integration/without-raw/allowCache.m3u8 b/test/fixtures/integration/without-raw/allowCache.m3u8 new file mode 100644 index 0000000..b661c38 --- /dev/null +++ b/test/fixtures/integration/without-raw/allowCache.m3u8 @@ -0,0 +1,58 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:4 +#EXT-X-ALLOW-CACHE:YES +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +#EXT-X-BYTERANGE:522828@0 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:587500@522828 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:713084@1110328 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:476580@1823412 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:535612@2299992 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:207176@2835604 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:455900@3042780 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:657248@3498680 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:571708@4155928 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:485040@4727636 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:709136@5212676 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:730004@5921812 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:456276@6651816 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:468684@7108092 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:444996@7576776 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:331444@8021772 +hls_450k_video.ts +#EXTINF:1.4167, +#EXT-X-BYTERANGE:44556@8353216 +hls_450k_video.ts +#EXT-X-ENDLIST \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/allowCacheInvalid.js b/test/fixtures/integration/without-raw/allowCacheInvalid.js new file mode 100644 index 0000000..2ee8d2b --- /dev/null +++ b/test/fixtures/integration/without-raw/allowCacheInvalid.js @@ -0,0 +1,22 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + byterange: { + length: 522828, + offset: 0 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 4 +}; diff --git a/test/fixtures/integration/without-raw/allowCacheInvalid.m3u8 b/test/fixtures/integration/without-raw/allowCacheInvalid.m3u8 new file mode 100644 index 0000000..04ad5fe --- /dev/null +++ b/test/fixtures/integration/without-raw/allowCacheInvalid.m3u8 @@ -0,0 +1,10 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:4 +#EXT-X-ALLOW-CACHE:0 +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +#EXT-X-BYTERANGE:522828@0 +hls_450k_video.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/alternateAudio.js b/test/fixtures/integration/without-raw/alternateAudio.js new file mode 100644 index 0000000..61a30fc --- /dev/null +++ b/test/fixtures/integration/without-raw/alternateAudio.js @@ -0,0 +1,58 @@ +module.exports = { + allowCache: true, + discontinuityStarts: [], + mediaGroups: { + // TYPE + 'AUDIO': { + // GROUP-ID + audio: { + // NAME + English: { + language: 'eng', + autoselect: true, + default: true, + uri: 'eng/prog_index.m3u8' + }, + // NAME + Français: { + language: 'fre', + autoselect: true, + default: false, + uri: 'fre/prog_index.m3u8' + }, + // NAME + Espanol: { + language: 'sp', + autoselect: true, + default: false, + uri: 'sp/prog_index.m3u8' + } + } + }, + 'VIDEO': {}, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + playlists: [{ + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 195023, + 'CODECS': 'avc1.42e00a,mp4a.40.2', + 'AUDIO': 'audio' + }, + raw: undefined, + timeline: 0, + uri: 'lo/prog_index.m3u8' + }, { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 591680, + 'CODECS': 'avc1.42e01e,mp4a.40.2', + 'AUDIO': 'audio' + }, + raw: undefined, + timeline: 0, + uri: 'hi/prog_index.m3u8' + }], + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/alternateAudio.m3u8 b/test/fixtures/integration/without-raw/alternateAudio.m3u8 new file mode 100644 index 0000000..a8a7f64 --- /dev/null +++ b/test/fixtures/integration/without-raw/alternateAudio.m3u8 @@ -0,0 +1,9 @@ +#EXTM3U +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES,URI="eng/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="fre/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="sp/prog_index.m3u8" + +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS="avc1.42e00a,mp4a.40.2",AUDIO="audio" +lo/prog_index.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS="avc1.42e01e,mp4a.40.2",AUDIO="audio" +hi/prog_index.m3u8 \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/alternateVideo.js b/test/fixtures/integration/without-raw/alternateVideo.js new file mode 100644 index 0000000..4be808b --- /dev/null +++ b/test/fixtures/integration/without-raw/alternateVideo.js @@ -0,0 +1,49 @@ +module.exports = { + allowCache: true, + discontinuityStarts: [], + mediaGroups: { + 'AUDIO': { + aac: { + English: { + autoselect: true, + default: true, + language: 'eng', + uri: 'eng/prog_index.m3u8' + } + } + }, + 'VIDEO': { + '500kbs': { + Angle1: { + autoselect: true, + default: true + }, + Angle2: { + autoselect: true, + default: false, + uri: 'Angle2/500kbs/prog_index.m3u8' + }, + Angle3: { + autoselect: true, + default: false, + uri: 'Angle3/500kbs/prog_index.m3u8' + } + } + }, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + playlists: [{ + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 754857, + 'CODECS': 'mp4a.40.2,avc1.4d401e', + 'AUDIO': 'aac', + 'VIDEO': '500kbs' + }, + raw: undefined, + timeline: 0, + uri: 'Angle1/500kbs/prog_index.m3u8' + }], + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/alternateVideo.m3u8 b/test/fixtures/integration/without-raw/alternateVideo.m3u8 new file mode 100644 index 0000000..96c1842 --- /dev/null +++ b/test/fixtures/integration/without-raw/alternateVideo.m3u8 @@ -0,0 +1,8 @@ +#EXTM3U +#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle1",AUTOSELECT=YES,DEFAULT=YES +#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle2",AUTOSELECT=YES,DEFAULT=NO,URI="Angle2/500kbs/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle3",AUTOSELECT=YES,DEFAULT=NO,URI="Angle3/500kbs/prog_index.m3u8" + +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="eng/prog_index.m3u8" +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=754857,CODECS="mp4a.40.2,avc1.4d401e",VIDEO="500kbs",AUDIO="aac" +Angle1/500kbs/prog_index.m3u8 \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/brightcove.js b/test/fixtures/integration/without-raw/brightcove.js new file mode 100644 index 0000000..61aee79 --- /dev/null +++ b/test/fixtures/integration/without-raw/brightcove.js @@ -0,0 +1,61 @@ +module.exports = { + allowCache: true, + playlists: [ + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 240000, + 'RESOLUTION': { + width: 396, + height: 224 + } + }, + raw: undefined, + timeline: 0, + uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001' + }, + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 40000 + }, + raw: undefined, + timeline: 0, + uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001' + }, + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 440000, + 'RESOLUTION': { + width: 396, + height: 224 + } + }, + raw: undefined, + timeline: 0, + uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001' + }, + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 1928000, + 'RESOLUTION': { + width: 960, + height: 540 + } + }, + raw: undefined, + timeline: 0, + uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001' + } + ], + discontinuityStarts: [], + mediaGroups: { + 'VIDEO': {}, + 'AUDIO': {}, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/brightcove.m3u8 b/test/fixtures/integration/without-raw/brightcove.m3u8 new file mode 100644 index 0000000..cdd1226 --- /dev/null +++ b/test/fixtures/integration/without-raw/brightcove.m3u8 @@ -0,0 +1,9 @@ +#EXTM3U +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=396x224 +http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=40000 +http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000,RESOLUTION=396x224 +http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540 +http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001 diff --git a/test/fixtures/integration/without-raw/byteRange.js b/test/fixtures/integration/without-raw/byteRange.js new file mode 100644 index 0000000..0a56071 --- /dev/null +++ b/test/fixtures/integration/without-raw/byteRange.js @@ -0,0 +1,178 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 587500, + offset: 522828 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 713084, + offset: 1110328 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video2.ts' + }, + { + byterange: { + length: 476580, + offset: 1823412 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 535612, + offset: 2299992 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 207176, + offset: 2835604 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 455900, + offset: 3042780 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 657248, + offset: 3498680 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 571708, + offset: 4155928 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 485040, + offset: 4727636 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 709136, + offset: 5212676 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 730004, + offset: 5921812 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 456276, + offset: 6651816 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 468684, + offset: 7108092 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 444996, + offset: 7576776 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 331444, + offset: 8021772 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 44556, + offset: 8353216 + }, + duration: 1.4167, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 3 +}; diff --git a/test/fixtures/integration/without-raw/byteRange.m3u8 b/test/fixtures/integration/without-raw/byteRange.m3u8 new file mode 100644 index 0000000..3b1be99 --- /dev/null +++ b/test/fixtures/integration/without-raw/byteRange.m3u8 @@ -0,0 +1,56 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:3 +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:587500@522828 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:713084 +hls_450k_video2.ts +#EXTINF:10, +#EXT-X-BYTERANGE:476580@1823412 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:535612@2299992 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:207176@2835604 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:455900@3042780 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:657248@3498680 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:571708@4155928 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:485040@4727636 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:709136@5212676 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:730004@5921812 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:456276@6651816 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:468684@7108092 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:444996@7576776 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:331444@8021772 +hls_450k_video.ts +#EXTINF:1.4167, +#EXT-X-BYTERANGE:44556@8353216 +hls_450k_video.ts +#EXT-X-ENDLIST \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/dateTime.js b/test/fixtures/integration/without-raw/dateTime.js new file mode 100644 index 0000000..b8c996f --- /dev/null +++ b/test/fixtures/integration/without-raw/dateTime.js @@ -0,0 +1,29 @@ +module.exports = { + allowCache: false, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + dateTimeString: '2016-06-22T09:20:16.166-04:00', + dateTimeObject: new Date('2016-06-22T09:20:16.166-04:00'), + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + dateTimeString: '2016-06-22T09:20:26.166-04:00', + dateTimeObject: new Date('2016-06-22T09:20:26.166-04:00'), + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + dateTimeString: '2016-06-22T09:20:16.166-04:00', + dateTimeObject: new Date('2016-06-22T09:20:16.166-04:00'), + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/dateTime.m3u8 b/test/fixtures/integration/without-raw/dateTime.m3u8 new file mode 100644 index 0000000..f3b8f6c --- /dev/null +++ b/test/fixtures/integration/without-raw/dateTime.m3u8 @@ -0,0 +1,12 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-ALLOW-CACHE:NO +#EXT-X-TARGETDURATION:10 +#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:16.166-04:00 +#EXTINF:10 +hls_450k_video.ts +#EXT-X-PROGRAM-DATE-TIME:2016-06-22T09:20:26.166-04:00 +#EXTINF:10 +hls_450k_video.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/diff-init-key.js b/test/fixtures/integration/without-raw/diff-init-key.js new file mode 100644 index 0000000..4cbb32f --- /dev/null +++ b/test/fixtures/integration/without-raw/diff-init-key.js @@ -0,0 +1,175 @@ +module.exports = { + allowCache: true, + discontinuitySequence: 0, + discontinuityStarts: [], + mediaSequence: 7794, + segments: [ + { + duration: 2.833, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=52' + }, + map: { + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=52' + }, + uri: 'http://media.example.com/init52.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence52-A.m4s' + }, + { + duration: 15, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=52' + }, + map: { + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=52' + }, + uri: 'http://media.example.com/init52.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence52-B.m4s' + }, + { + duration: 13.333, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=52' + }, + map: { + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=52' + }, + uri: 'http://media.example.com/init52.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence52-C.m4s' + }, + { + duration: 15, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=53' + }, + map: { + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=53' + }, + uri: 'http://media.example.com/init53-A.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence53-A.m4s' + }, + { + duration: 14, + key: { + iv: new Uint32Array([0, 0, 331, 3063767524]), + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=53' + }, + map: { + key: { + iv: new Uint32Array([0, 0, 331, 3063767524]), + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=53' + }, + uri: 'http://media.example.com/init53-B.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence53-B.m4s' + }, + { + duration: 12, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=54' + }, + map: { + uri: 'http://media.example.com/init54-A.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence54-A.m4s' + }, + { + duration: 13, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=54' + }, + map: { + uri: 'http://media.example.com/init54-A.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence54-B.m4s' + }, + { + duration: 10, + map: { + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=54' + }, + uri: 'http://media.example.com/init54-B.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence54-A.m4s' + }, + { + duration: 11, + map: { + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=54' + }, + uri: 'http://media.example.com/init54-B.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence54-B.m4s' + }, + { + duration: 4, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=54-b' + }, + map: { + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=54-a' + }, + uri: 'http://media.example.com/init54-D.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence54-A.m4s' + }, + { + duration: 12, + map: { + uri: 'http://media.example.com/init54-E.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence54-A.m4s' + } + ], + targetDuration: 15, + version: 7 +}; diff --git a/test/fixtures/integration/without-raw/diff-init-key.m3u8 b/test/fixtures/integration/without-raw/diff-init-key.m3u8 new file mode 100644 index 0000000..608ca13 --- /dev/null +++ b/test/fixtures/integration/without-raw/diff-init-key.m3u8 @@ -0,0 +1,57 @@ +#EXTM3U +#EXT-X-VERSION:7 +#EXT-X-MEDIA-SEQUENCE:7794 +#EXT-X-TARGETDURATION:15 + +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52" +#EXT-X-MAP:URI="http://media.example.com/init52.mp4" + +#EXTINF:2.833, +http://media.example.com/fileSequence52-A.m4s +#EXTINF:15.0, +http://media.example.com/fileSequence52-B.m4s +#EXTINF:13.333, +http://media.example.com/fileSequence52-C.m4s + +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" +#EXT-X-MAP:URI="http://media.example.com/init53-A.mp4" + +#EXTINF:15.0, +http://media.example.com/fileSequence53-A.m4s + +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53",IV=0x00000000000000000000014BB69D61E4 +#EXT-X-MAP:URI="http://media.example.com/init53-B.mp4" + +#EXTINF:14.0, +http://media.example.com/fileSequence53-B.m4s + +#EXT-X-KEY:METHOD=NONE +#EXT-X-MAP:URI="http://media.example.com/init54-A.mp4" +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54" + +#EXTINF:12.0, +http://media.example.com/fileSequence54-A.m4s +#EXTINF:13.0, +http://media.example.com/fileSequence54-B.m4s + +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54" +#EXT-X-MAP:URI="http://media.example.com/init54-B.mp4" +#EXT-X-KEY:METHOD=NONE + +#EXTINF:10.0, +http://media.example.com/fileSequence54-A.m4s +#EXTINF:11.0, +http://media.example.com/fileSequence54-B.m4s + +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54-a" +#EXT-X-MAP:URI="http://media.example.com/init54-D.mp4" +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54-b" + +#EXTINF:4.0, +http://media.example.com/fileSequence54-A.m4s + +#EXT-X-KEY:METHOD=NONE +#EXT-X-MAP:URI="http://media.example.com/init54-E.mp4" + +#EXTINF:12.0, +http://media.example.com/fileSequence54-A.m4s diff --git a/test/fixtures/integration/without-raw/disallowCache.js b/test/fixtures/integration/without-raw/disallowCache.js new file mode 100644 index 0000000..7e4351c --- /dev/null +++ b/test/fixtures/integration/without-raw/disallowCache.js @@ -0,0 +1,22 @@ +module.exports = { + allowCache: false, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + byterange: { + length: 522828, + offset: 0 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 4 +}; diff --git a/test/fixtures/integration/without-raw/disallowCache.m3u8 b/test/fixtures/integration/without-raw/disallowCache.m3u8 new file mode 100644 index 0000000..a3a40f9 --- /dev/null +++ b/test/fixtures/integration/without-raw/disallowCache.m3u8 @@ -0,0 +1,10 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:4 +#EXT-X-ALLOW-CACHE:NO +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +#EXT-X-BYTERANGE:522828@0 +hls_450k_video.ts +#EXT-X-ENDLIST \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/disc-sequence.js b/test/fixtures/integration/without-raw/disc-sequence.js new file mode 100644 index 0000000..e2fd4ad --- /dev/null +++ b/test/fixtures/integration/without-raw/disc-sequence.js @@ -0,0 +1,36 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + discontinuitySequence: 3, + segments: [ + { + duration: 10, + raw: undefined, + timeline: 3, + uri: '001.ts' + }, + { + duration: 19, + raw: undefined, + timeline: 3, + uri: '002.ts' + }, + { + discontinuity: true, + duration: 10, + raw: undefined, + timeline: 4, + uri: '003.ts' + }, + { + duration: 11, + raw: undefined, + timeline: 4, + uri: '004.ts' + } + ], + targetDuration: 19, + endList: true, + discontinuityStarts: [2], + version: 3 +}; diff --git a/test/fixtures/integration/without-raw/disc-sequence.m3u8 b/test/fixtures/integration/without-raw/disc-sequence.m3u8 new file mode 100644 index 0000000..5ac89ba --- /dev/null +++ b/test/fixtures/integration/without-raw/disc-sequence.m3u8 @@ -0,0 +1,15 @@ +#EXTM3U +#EXT-X-VERSION:3 +#EXT-X-TARGETDURATION:19 +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-DISCONTINUITY-SEQUENCE:3 +#EXTINF:10,0 +001.ts +#EXTINF:19,0 +002.ts +#EXT-X-DISCONTINUITY +#EXTINF:10,0 +003.ts +#EXTINF:11,0 +004.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/discontinuity.js b/test/fixtures/integration/without-raw/discontinuity.js new file mode 100644 index 0000000..cc7fcf2 --- /dev/null +++ b/test/fixtures/integration/without-raw/discontinuity.js @@ -0,0 +1,68 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + discontinuitySequence: 0, + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '001.ts' + }, + { + duration: 19, + raw: undefined, + timeline: 0, + uri: '002.ts' + }, + { + discontinuity: true, + duration: 10, + raw: undefined, + timeline: 1, + uri: '003.ts' + }, + { + duration: 11, + raw: undefined, + timeline: 1, + uri: '004.ts' + }, + { + discontinuity: true, + duration: 10, + raw: undefined, + timeline: 2, + uri: '005.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 2, + uri: '006.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 2, + uri: '007.ts' + }, + { + discontinuity: true, + duration: 10, + raw: undefined, + timeline: 3, + uri: '008.ts' + }, + { + duration: 16, + raw: undefined, + timeline: 3, + uri: '009.ts' + } + ], + targetDuration: 19, + endList: true, + discontinuityStarts: [2, 4, 7], + version: 3 +}; diff --git a/test/fixtures/integration/without-raw/discontinuity.m3u8 b/test/fixtures/integration/without-raw/discontinuity.m3u8 new file mode 100644 index 0000000..46a0cc9 --- /dev/null +++ b/test/fixtures/integration/without-raw/discontinuity.m3u8 @@ -0,0 +1,26 @@ +#EXTM3U +#EXT-X-VERSION:3 +#EXT-X-TARGETDURATION:19 +#EXT-X-MEDIA-SEQUENCE:0 +#EXTINF:10,0 +001.ts +#EXTINF:19,0 +002.ts +#EXT-X-DISCONTINUITY +#EXTINF:10,0 +003.ts +#EXTINF:11,0 +004.ts +#EXT-X-DISCONTINUITY +#EXTINF:10,0 +005.ts +#EXTINF:10,0 +006.ts +#EXTINF:10,0 +007.ts +#EXT-X-DISCONTINUITY +#EXTINF:10,0 +008.ts +#EXTINF:16,0 +009.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/domainUris.js b/test/fixtures/integration/without-raw/domainUris.js new file mode 100644 index 0000000..f4498c3 --- /dev/null +++ b/test/fixtures/integration/without-raw/domainUris.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/subdir/00002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/00003.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/00004.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/domainUris.m3u8 b/test/fixtures/integration/without-raw/domainUris.m3u8 new file mode 100644 index 0000000..8134d07 --- /dev/null +++ b/test/fixtures/integration/without-raw/domainUris.m3u8 @@ -0,0 +1,12 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-TARGETDURATION:10 +#EXTINF:10, +/00001.ts +#EXTINF:10, +/subdir/00002.ts +#EXTINF:10, +/00003.ts +#EXTINF:10, +/00004.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/empty.js b/test/fixtures/integration/without-raw/empty.js new file mode 100644 index 0000000..4c9fc43 --- /dev/null +++ b/test/fixtures/integration/without-raw/empty.js @@ -0,0 +1,5 @@ +module.exports = { + allowCache: true, + discontinuityStarts: [], + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/empty.m3u8 b/test/fixtures/integration/without-raw/empty.m3u8 new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/integration/without-raw/emptyAllowCache.js b/test/fixtures/integration/without-raw/emptyAllowCache.js new file mode 100644 index 0000000..2ee8d2b --- /dev/null +++ b/test/fixtures/integration/without-raw/emptyAllowCache.js @@ -0,0 +1,22 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + byterange: { + length: 522828, + offset: 0 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 4 +}; diff --git a/test/fixtures/integration/without-raw/emptyAllowCache.m3u8 b/test/fixtures/integration/without-raw/emptyAllowCache.m3u8 new file mode 100644 index 0000000..d9e6bd7 --- /dev/null +++ b/test/fixtures/integration/without-raw/emptyAllowCache.m3u8 @@ -0,0 +1,10 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:4 +#EXT-X-ALLOW-CACHE: +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +#EXT-X-BYTERANGE:522828@0 +hls_450k_video.ts +#EXT-X-ENDLIST \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/emptyMediaSequence.js b/test/fixtures/integration/without-raw/emptyMediaSequence.js new file mode 100644 index 0000000..764b0d3 --- /dev/null +++ b/test/fixtures/integration/without-raw/emptyMediaSequence.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + }, + { + duration: 6.08, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + }, + { + duration: 6.6, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + }, + { + duration: 5, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + } + ], + targetDuration: 8, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/emptyMediaSequence.m3u8 b/test/fixtures/integration/without-raw/emptyMediaSequence.m3u8 new file mode 100644 index 0000000..3c39e87 --- /dev/null +++ b/test/fixtures/integration/without-raw/emptyMediaSequence.m3u8 @@ -0,0 +1,14 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MEDIA-SEQUENCE: +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +#EXTINF:6.080,{} +/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts +#EXTINF:6.600,{} +/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts +#EXTINF:5.000,{} +/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/emptyPlaylistType.js b/test/fixtures/integration/without-raw/emptyPlaylistType.js new file mode 100644 index 0000000..200013f --- /dev/null +++ b/test/fixtures/integration/without-raw/emptyPlaylistType.js @@ -0,0 +1,46 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' + }, + { + duration: 8, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/emptyPlaylistType.m3u8 b/test/fixtures/integration/without-raw/emptyPlaylistType.m3u8 new file mode 100644 index 0000000..0396ca4 --- /dev/null +++ b/test/fixtures/integration/without-raw/emptyPlaylistType.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE: +#EXT-X-TARGETDURATION:10 +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts +#EXTINF:8, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/emptyTargetDuration.js b/test/fixtures/integration/without-raw/emptyTargetDuration.js new file mode 100644 index 0000000..61aee79 --- /dev/null +++ b/test/fixtures/integration/without-raw/emptyTargetDuration.js @@ -0,0 +1,61 @@ +module.exports = { + allowCache: true, + playlists: [ + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 240000, + 'RESOLUTION': { + width: 396, + height: 224 + } + }, + raw: undefined, + timeline: 0, + uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001' + }, + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 40000 + }, + raw: undefined, + timeline: 0, + uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001' + }, + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 440000, + 'RESOLUTION': { + width: 396, + height: 224 + } + }, + raw: undefined, + timeline: 0, + uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001' + }, + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 1928000, + 'RESOLUTION': { + width: 960, + height: 540 + } + }, + raw: undefined, + timeline: 0, + uri: 'http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001' + } + ], + discontinuityStarts: [], + mediaGroups: { + 'VIDEO': {}, + 'AUDIO': {}, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/emptyTargetDuration.m3u8 b/test/fixtures/integration/without-raw/emptyTargetDuration.m3u8 new file mode 100644 index 0000000..0bb62a6 --- /dev/null +++ b/test/fixtures/integration/without-raw/emptyTargetDuration.m3u8 @@ -0,0 +1,10 @@ +#EXTM3U +#EXT-X-TARGETDURATION: +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=396x224 +http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686811001&videoId=1824650741001 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=40000 +http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824683759001&videoId=1824650741001 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000,RESOLUTION=396x224 +http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824686593001&videoId=1824650741001 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540 +http://c.brightcove.com/services/mobile/streaming/index/rendition.m3u8?assetId=1824687660001&videoId=1824650741001 diff --git a/test/fixtures/integration/without-raw/encrypted.js b/test/fixtures/integration/without-raw/encrypted.js new file mode 100644 index 0000000..da6edb5 --- /dev/null +++ b/test/fixtures/integration/without-raw/encrypted.js @@ -0,0 +1,67 @@ +module.exports = { + allowCache: true, + mediaSequence: 7794, + discontinuitySequence: 0, + discontinuityStarts: [], + segments: [ + { + duration: 2.833, + raw: undefined, + timeline: 0, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=52' + }, + uri: 'http://media.example.com/fileSequence52-A.ts' + }, + { + duration: 15, + raw: undefined, + timeline: 0, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=52' + }, + uri: 'http://media.example.com/fileSequence52-B.ts' + }, + { + duration: 13.333, + raw: undefined, + timeline: 0, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=52' + }, + uri: 'http://media.example.com/fileSequence52-C.ts' + }, + { + duration: 15, + raw: undefined, + timeline: 0, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=53' + }, + uri: 'http://media.example.com/fileSequence53-A.ts' + }, + { + duration: 14, + raw: undefined, + timeline: 0, + key: { + method: 'AES-128', + uri: 'https://priv.example.com/key.php?r=54', + iv: new Uint32Array([0, 0, 331, 3063767524]) + }, + uri: 'http://media.example.com/fileSequence53-B.ts' + }, + { + duration: 15, + raw: undefined, + timeline: 0, + uri: 'http://media.example.com/fileSequence53-B.ts' + } + ], + targetDuration: 15, + version: 3 +}; diff --git a/test/fixtures/integration/without-raw/encrypted.m3u8 b/test/fixtures/integration/without-raw/encrypted.m3u8 new file mode 100644 index 0000000..2f12209 --- /dev/null +++ b/test/fixtures/integration/without-raw/encrypted.m3u8 @@ -0,0 +1,28 @@ +#EXTM3U +#EXT-X-VERSION:3 +#EXT-X-MEDIA-SEQUENCE:7794 +#EXT-X-TARGETDURATION:15 + +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52" + +#EXTINF:2.833, +http://media.example.com/fileSequence52-A.ts +#EXTINF:15.0, +http://media.example.com/fileSequence52-B.ts +#EXTINF:13.333, +http://media.example.com/fileSequence52-C.ts + +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=53" + +#EXTINF:15.0, +http://media.example.com/fileSequence53-A.ts + +#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=54",IV=0x00000000000000000000014BB69D61E4 + +#EXTINF:14.0, +http://media.example.com/fileSequence53-B.ts + +#EXT-X-KEY:METHOD=NONE + +#EXTINF:15.0, +http://media.example.com/fileSequence53-B.ts \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/event.js b/test/fixtures/integration/without-raw/event.js new file mode 100644 index 0000000..596e101 --- /dev/null +++ b/test/fixtures/integration/without-raw/event.js @@ -0,0 +1,47 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'EVENT', + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' + }, + { + duration: 8, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/event.m3u8 b/test/fixtures/integration/without-raw/event.m3u8 new file mode 100644 index 0000000..cb6381d --- /dev/null +++ b/test/fixtures/integration/without-raw/event.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:EVENT +#EXT-X-TARGETDURATION:10 +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts +#EXTINF:8, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/extXPlaylistTypeInvalidPlaylist.js b/test/fixtures/integration/without-raw/extXPlaylistTypeInvalidPlaylist.js new file mode 100644 index 0000000..8ea8577 --- /dev/null +++ b/test/fixtures/integration/without-raw/extXPlaylistTypeInvalidPlaylist.js @@ -0,0 +1,16 @@ +module.exports = { + allowCache: true, + mediaSequence: 1, + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + } + ], + targetDuration: 8, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/extXPlaylistTypeInvalidPlaylist.m3u8 b/test/fixtures/integration/without-raw/extXPlaylistTypeInvalidPlaylist.m3u8 new file mode 100644 index 0000000..f2a777a --- /dev/null +++ b/test/fixtures/integration/without-raw/extXPlaylistTypeInvalidPlaylist.m3u8 @@ -0,0 +1,8 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:STRING +#EXT-X-MEDIA-SEQUENCE:1 +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/extinf.js b/test/fixtures/integration/without-raw/extinf.js new file mode 100644 index 0000000..4be7ea0 --- /dev/null +++ b/test/fixtures/integration/without-raw/extinf.js @@ -0,0 +1,182 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + byterange: { + length: 522828, + offset: 0 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 587500, + offset: 522828 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 713084, + offset: 1110328 + }, + duration: 5, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 476580, + offset: 1823412 + }, + duration: 9.7, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 535612, + offset: 2299992 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 207176, + offset: 2835604 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 455900, + offset: 3042780 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 657248, + offset: 3498680 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 571708, + offset: 4155928 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 485040, + offset: 4727636 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 709136, + offset: 5212676 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 730004, + offset: 5921812 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 456276, + offset: 6651816 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 468684, + offset: 7108092 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 444996, + offset: 7576776 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 331444, + offset: 8021772 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 44556, + offset: 8353216 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 3 +}; diff --git a/test/fixtures/integration/without-raw/extinf.m3u8 b/test/fixtures/integration/without-raw/extinf.m3u8 new file mode 100644 index 0000000..d080361 --- /dev/null +++ b/test/fixtures/integration/without-raw/extinf.m3u8 @@ -0,0 +1,57 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:3 +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10 +#EXT-X-BYTERANGE:522828@0 +hls_450k_video.ts +#EXTINF:;asljasdfii11)))00, +#EXT-X-BYTERANGE:587500@522828 +hls_450k_video.ts +#EXTINF:5, +#EXT-X-BYTERANGE:713084@1110328 +hls_450k_video.ts +#EXTINF:9.7, +#EXT-X-BYTERANGE:476580@1823412 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:535612@2299992 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:207176@2835604 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:455900@3042780 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:657248@3498680 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:571708@4155928 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:485040@4727636 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:709136@5212676 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:730004@5921812 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:456276@6651816 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:468684@7108092 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:444996@7576776 +hls_450k_video.ts +#EXTINF:22, +#EXTINF:10, +#EXT-X-BYTERANGE:331444@8021772 +hls_450k_video.ts +#EXT-X-BYTERANGE:44556@8353216 +hls_450k_video.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/fmp4.js b/test/fixtures/integration/without-raw/fmp4.js new file mode 100644 index 0000000..850679f --- /dev/null +++ b/test/fixtures/integration/without-raw/fmp4.js @@ -0,0 +1,46 @@ +module.exports = { + allowCache: true, + mediaSequence: 1, + playlistType: 'VOD', + targetDuration: 6, + discontinuitySequence: 0, + discontinuityStarts: [], + segments: [ + { + byterange: { + length: 5666510, + offset: 720 + }, + duration: 6.006, + raw: undefined, + timeline: 0, + uri: 'main.mp4', + map: { + byterange: { + length: 720, + offset: 0 + }, + uri: 'main.mp4' + } + }, + { + byterange: { + length: 5861577, + offset: 5667230 + }, + duration: 6.006, + raw: undefined, + timeline: 0, + uri: 'main.mp4', + map: { + byterange: { + length: 720, + offset: 0 + }, + uri: 'main.mp4' + } + } + ], + endList: true, + version: 7 +}; diff --git a/test/fixtures/integration/without-raw/fmp4.m3u8 b/test/fixtures/integration/without-raw/fmp4.m3u8 new file mode 100644 index 0000000..8da75c7 --- /dev/null +++ b/test/fixtures/integration/without-raw/fmp4.m3u8 @@ -0,0 +1,14 @@ +#EXTM3U +#EXT-X-TARGETDURATION:6 +#EXT-X-VERSION:7 +#EXT-X-MEDIA-SEQUENCE:1 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-INDEPENDENT-SEGMENTS +#EXT-X-MAP:URI="main.mp4",BYTERANGE="720@0" +#EXTINF:6.00600, +#EXT-X-BYTERANGE:5666510@720 +main.mp4 +#EXTINF:6.00600, +#EXT-X-BYTERANGE:5861577@5667230 +main.mp4 +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/headerOnly.js b/test/fixtures/integration/without-raw/headerOnly.js new file mode 100644 index 0000000..4c9fc43 --- /dev/null +++ b/test/fixtures/integration/without-raw/headerOnly.js @@ -0,0 +1,5 @@ +module.exports = { + allowCache: true, + discontinuityStarts: [], + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/headerOnly.m3u8 b/test/fixtures/integration/without-raw/headerOnly.m3u8 new file mode 100644 index 0000000..fcd7187 --- /dev/null +++ b/test/fixtures/integration/without-raw/headerOnly.m3u8 @@ -0,0 +1 @@ +#EXTM3U diff --git a/test/fixtures/integration/without-raw/invalidAllowCache.js b/test/fixtures/integration/without-raw/invalidAllowCache.js new file mode 100644 index 0000000..2ee8d2b --- /dev/null +++ b/test/fixtures/integration/without-raw/invalidAllowCache.js @@ -0,0 +1,22 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + byterange: { + length: 522828, + offset: 0 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 4 +}; diff --git a/test/fixtures/integration/without-raw/invalidAllowCache.m3u8 b/test/fixtures/integration/without-raw/invalidAllowCache.m3u8 new file mode 100644 index 0000000..09a1efb --- /dev/null +++ b/test/fixtures/integration/without-raw/invalidAllowCache.m3u8 @@ -0,0 +1,10 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:4 +#EXT-X-ALLOW-CACHE:MAYBE +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +#EXT-X-BYTERANGE:522828@0 +hls_450k_video.ts +#EXT-X-ENDLIST \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/invalidMediaSequence.js b/test/fixtures/integration/without-raw/invalidMediaSequence.js new file mode 100644 index 0000000..764b0d3 --- /dev/null +++ b/test/fixtures/integration/without-raw/invalidMediaSequence.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + }, + { + duration: 6.08, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + }, + { + duration: 6.6, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + }, + { + duration: 5, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + } + ], + targetDuration: 8, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/invalidMediaSequence.m3u8 b/test/fixtures/integration/without-raw/invalidMediaSequence.m3u8 new file mode 100644 index 0000000..e6831f1 --- /dev/null +++ b/test/fixtures/integration/without-raw/invalidMediaSequence.m3u8 @@ -0,0 +1,14 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MEDIA-SEQUENCE:gobblegobble +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +#EXTINF:6.080,{} +/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts +#EXTINF:6.600,{} +/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts +#EXTINF:5.000,{} +/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/invalidPlaylistType.js b/test/fixtures/integration/without-raw/invalidPlaylistType.js new file mode 100644 index 0000000..200013f --- /dev/null +++ b/test/fixtures/integration/without-raw/invalidPlaylistType.js @@ -0,0 +1,46 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts' + }, + { + duration: 8, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/invalidPlaylistType.m3u8 b/test/fixtures/integration/without-raw/invalidPlaylistType.m3u8 new file mode 100644 index 0000000..8b95bed --- /dev/null +++ b/test/fixtures/integration/without-raw/invalidPlaylistType.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:asdRASDfasdR +#EXT-X-TARGETDURATION:10 +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00001.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00002.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00003.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00004.ts +#EXTINF:10, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00005.ts +#EXTINF:8, +/test/ts-files/zencoder/haze/Haze_Mantel_President_encoded_1200-00006.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/invalidTargetDuration.js b/test/fixtures/integration/without-raw/invalidTargetDuration.js new file mode 100644 index 0000000..887df69 --- /dev/null +++ b/test/fixtures/integration/without-raw/invalidTargetDuration.js @@ -0,0 +1,181 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + byterange: { + length: 522828, + offset: 0 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 587500, + offset: 522828 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 713084, + offset: 1110328 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 476580, + offset: 1823412 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 535612, + offset: 2299992 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 207176, + offset: 2835604 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 455900, + offset: 3042780 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 657248, + offset: 3498680 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 571708, + offset: 4155928 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 485040, + offset: 4727636 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 709136, + offset: 5212676 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 730004, + offset: 5921812 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 456276, + offset: 6651816 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 468684, + offset: 7108092 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 444996, + offset: 7576776 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 331444, + offset: 8021772 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 44556, + offset: 8353216 + }, + duration: 1.4167, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 4 +}; diff --git a/test/fixtures/integration/without-raw/invalidTargetDuration.m3u8 b/test/fixtures/integration/without-raw/invalidTargetDuration.m3u8 new file mode 100644 index 0000000..28b043b --- /dev/null +++ b/test/fixtures/integration/without-raw/invalidTargetDuration.m3u8 @@ -0,0 +1,57 @@ +#EXTM3U +#EXT-X-TARGETDURATION:NaN +#EXT-X-VERSION:4 +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +#EXT-X-BYTERANGE:522828@0 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:587500@522828 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:713084@1110328 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:476580@1823412 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:535612@2299992 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:207176@2835604 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:455900@3042780 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:657248@3498680 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:571708@4155928 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:485040@4727636 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:709136@5212676 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:730004@5921812 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:456276@6651816 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:468684@7108092 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:444996@7576776 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:331444@8021772 +hls_450k_video.ts +#EXTINF:1.4167, +#EXT-X-BYTERANGE:44556@8353216 +hls_450k_video.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/liveMissingSegmentDuration.js b/test/fixtures/integration/without-raw/liveMissingSegmentDuration.js new file mode 100644 index 0000000..fef7ba4 --- /dev/null +++ b/test/fixtures/integration/without-raw/liveMissingSegmentDuration.js @@ -0,0 +1,28 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + }, + { + duration: 8, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + }, + { + duration: 8, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + } + ], + targetDuration: 8, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/liveMissingSegmentDuration.m3u8 b/test/fixtures/integration/without-raw/liveMissingSegmentDuration.m3u8 new file mode 100644 index 0000000..eef755d --- /dev/null +++ b/test/fixtures/integration/without-raw/liveMissingSegmentDuration.m3u8 @@ -0,0 +1,9 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts +/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts diff --git a/test/fixtures/integration/without-raw/liveStart30sBefore.js b/test/fixtures/integration/without-raw/liveStart30sBefore.js new file mode 100644 index 0000000..60e71f5 --- /dev/null +++ b/test/fixtures/integration/without-raw/liveStart30sBefore.js @@ -0,0 +1,63 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '001.ts' + }, + { + duration: 19, + raw: undefined, + timeline: 0, + uri: '002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '003.ts' + }, + { + duration: 11, + raw: undefined, + timeline: 0, + uri: '004.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '005.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '006.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '007.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '008.ts' + }, + { + duration: 16, + raw: undefined, + timeline: 0, + uri: '009.ts' + } + ], + targetDuration: 10, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/liveStart30sBefore.m3u8 b/test/fixtures/integration/without-raw/liveStart30sBefore.m3u8 new file mode 100644 index 0000000..79abf59 --- /dev/null +++ b/test/fixtures/integration/without-raw/liveStart30sBefore.m3u8 @@ -0,0 +1,22 @@ +#EXTM3U +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:10 +#EXTINF:10,0 +001.ts +#EXTINF:19,0 +002.ts +#EXTINF:10,0 +003.ts +#EXTINF:11,0 +004.ts +#EXTINF:10,0 +005.ts +#EXTINF:10,0 +006.ts +#EXTINF:10,0 +007.ts +#EXTINF:10,0 +008.ts +#EXTINF:16,0 +009.ts \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/llhls-byte-range.js b/test/fixtures/integration/without-raw/llhls-byte-range.js new file mode 100644 index 0000000..3263999 --- /dev/null +++ b/test/fixtures/integration/without-raw/llhls-byte-range.js @@ -0,0 +1,271 @@ +module.exports = { + allowCache: true, + discontinuitySequence: 0, + discontinuityStarts: [], + mediaSequence: 0, + playlistType: 'VOD', + preloadSegment: { + preloadHints: [ + { + type: 'PART', + uri: 'filePart273.1.mp4', + byterange: { + length: 2000, + offset: 0 + } + }, + { + type: 'MAP', + uri: 'file-init.mp4', + byterange: { + length: 5000, + offset: 8355216 + } + }, + { + type: 'FOO', + uri: 'foo.mp4', + byterange: { + length: 5000, + offset: 0 + } + } + ], + raw: undefined, + timeline: 0 + }, + segments: [ + { + byterange: { + length: 587500, + offset: 0 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 587500, + offset: 522828 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 713084, + offset: 1110328 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video2.ts' + }, + { + byterange: { + length: 476580, + offset: 1823412 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 535612, + offset: 2299992 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 207176, + offset: 2835604 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 455900, + offset: 3042780 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 657248, + offset: 3498680 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 571708, + offset: 4155928 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 485040, + offset: 4727636 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 709136, + offset: 5212676 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 730004, + offset: 5921812 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 456276, + offset: 6651816 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 468684, + offset: 7108092 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 444996, + offset: 7576776 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 331444, + offset: 8021772 + }, + duration: 10, + parts: [ + { + duration: 0.33334, + uri: 'hls_450k_video.part.ts', + byterange: { + length: 45553, + offset: 0 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.part.ts', + byterange: { + length: 28823, + offset: 7622329 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.part.ts', + byterange: { + length: 22444, + offset: 7651152 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.part.ts', + byterange: { + length: 22444, + offset: 7673596 + } + } + ], + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 44556, + offset: 8353216 + }, + duration: 1.4167, + parts: [ + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 45553, + offset: 8021772 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 28823, + offset: 8067325 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 22444, + offset: 8096148 + } + } + ], + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + version: 3 +}; diff --git a/test/fixtures/integration/without-raw/llhls-byte-range.m3u8 b/test/fixtures/integration/without-raw/llhls-byte-range.m3u8 new file mode 100644 index 0000000..15b18f7 --- /dev/null +++ b/test/fixtures/integration/without-raw/llhls-byte-range.m3u8 @@ -0,0 +1,66 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:3 +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +#EXT-X-BYTERANGE:587500@ +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:587500@522828 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:713084 +hls_450k_video2.ts +#EXTINF:10, +#EXT-X-BYTERANGE:476580@1823412 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:535612@2299992 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:207176@2835604 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:455900@3042780 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:657248@3498680 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:571708@4155928 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:485040@4727636 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:709136@5212676 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:730004@5921812 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:456276@6651816 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:468684@7108092 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:444996@7576776 +hls_450k_video.ts +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.part.ts",BYTERANGE=45553 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.part.ts",BYTERANGE=28823@7622329 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.part.ts",BYTERANGE=22444 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.part.ts",BYTERANGE=22444 +#EXTINF:10, +#EXT-X-BYTERANGE:331444@8021772 +hls_450k_video.ts +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=45553@8021772 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=28823 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 +#EXTINF:1.4167, +#EXT-X-BYTERANGE:44556@8353216 +hls_450k_video.ts +#EXT-X-PRELOAD-HINT:TYPE=PART,URI="filePart273.1.mp4",BYTERANGE-LENGTH=2000 +#EXT-X-PRELOAD-HINT:TYPE=MAP,URI="file-init.mp4",BYTERANGE-LENGTH=5000,BYTERANGE-START=8355216 +#EXT-X-PRELOAD-HINT:TYPE=FOO,URI="foo.mp4",BYTERANGE-LENGTH=5000 diff --git a/test/fixtures/integration/without-raw/llhls-delta-byte-range.js b/test/fixtures/integration/without-raw/llhls-delta-byte-range.js new file mode 100644 index 0000000..949e579 --- /dev/null +++ b/test/fixtures/integration/without-raw/llhls-delta-byte-range.js @@ -0,0 +1,154 @@ +module.exports = { + allowCache: true, + discontinuitySequence: 0, + discontinuityStarts: [], + mediaSequence: 0, + playlistType: 'VOD', + preloadSegment: { + parts: [ + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 22444, + offset: 0 + } + } + ], + preloadHints: [ + { + type: 'PART', + uri: 'filePart273.1.mp4', + byterange: { + length: 2000, + offset: 22444 + } + }, + { + type: 'MAP', + uri: 'file-init.mp4', + byterange: { + length: 5000, + offset: 8377660 + } + }, + { + type: 'FOO', + uri: 'foo.mp4', + byterange: { + length: 5000, + offset: 0 + } + } + ], + raw: undefined, + timeline: 0 + }, + segments: [ + { + byterange: { + length: 468684, + offset: 7108092 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 444996, + offset: 7576776 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 331444, + offset: 8021772 + }, + duration: 10, + parts: [ + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 45553, + offset: 0 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 28823, + offset: 7622329 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 22444, + offset: 7651152 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 22444, + offset: 7673596 + } + } + ], + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 44556, + offset: 8353216 + }, + duration: 1.4167, + parts: [ + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 45553, + offset: 8021772 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 28823, + offset: 8067325 + } + }, + { + duration: 0.33334, + uri: 'hls_450k_video.ts', + byterange: { + length: 22444, + offset: 8096148 + } + } + ], + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + skip: { + skippedSegments: 3 + }, + targetDuration: 10, + version: 3 +}; diff --git a/test/fixtures/integration/without-raw/llhls-delta-byte-range.m3u8 b/test/fixtures/integration/without-raw/llhls-delta-byte-range.m3u8 new file mode 100644 index 0000000..d884ccc --- /dev/null +++ b/test/fixtures/integration/without-raw/llhls-delta-byte-range.m3u8 @@ -0,0 +1,30 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:3 +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +#EXT-X-SKIP:SKIPPED-SEGMENTS=3 +#EXTINF:10, +#EXT-X-BYTERANGE:468684@7108092 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:444996@7576776 +hls_450k_video.ts +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=45553 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=28823@7622329 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 +#EXTINF:10, +#EXT-X-BYTERANGE:331444@8021772 +hls_450k_video.ts +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=45553@8021772 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=28823 +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 +#EXTINF:1.4167, +#EXT-X-BYTERANGE:44556@8353216 +hls_450k_video.ts +#EXT-X-PART:DURATION=0.33334,URI="hls_450k_video.ts",BYTERANGE=22444 +#EXT-X-PRELOAD-HINT:TYPE=PART,URI="filePart273.1.mp4",BYTERANGE-LENGTH=2000 +#EXT-X-PRELOAD-HINT:TYPE=MAP,URI="file-init.mp4",BYTERANGE-LENGTH=5000,BYTERANGE-START=8377660 +#EXT-X-PRELOAD-HINT:TYPE=FOO,URI="foo.mp4",BYTERANGE-LENGTH=5000 diff --git a/test/fixtures/integration/without-raw/llhls.js b/test/fixtures/integration/without-raw/llhls.js new file mode 100644 index 0000000..1282969 --- /dev/null +++ b/test/fixtures/integration/without-raw/llhls.js @@ -0,0 +1,222 @@ +module.exports = { + allowCache: true, + dateTimeObject: new Date('2019-02-14T02:13:36.106Z'), + dateTimeString: '2019-02-14T02:13:36.106Z', + discontinuitySequence: 0, + discontinuityStarts: [], + mediaSequence: 266, + preloadSegment: { + map: {uri: 'init.mp4'}, + parts: [ + { + duration: 0.33334, + independent: true, + uri: 'filePart273.0.mp4' + }, + { + duration: 0.33334, + uri: 'filePart273.1.mp4' + }, + { + duration: 0.33334, + uri: 'filePart273.2.mp4' + } + ], + preloadHints: [ + {type: 'PART', uri: 'filePart273.3.mp4'}, + {type: 'MAP', uri: 'file-init.mp4'} + ], + raw: undefined, + timeline: 0 + }, + renditionReports: [ + {lastMsn: 273, lastPart: 2, uri: '../1M/waitForMSN.php'}, + {lastMsn: 273, lastPart: 1, uri: '../4M/waitForMSN.php'} + ], + partInf: { + partTarget: 0.33334 + }, + partTargetDuration: 0.33334, + segments: [ + { + dateTimeObject: new Date('2019-02-14T02:13:36.106Z'), + dateTimeString: '2019-02-14T02:13:36.106Z', + duration: 4.00008, + map: { + uri: 'init.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'fileSequence266.mp4' + }, + { + duration: 4.00008, + map: { + uri: 'init.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'fileSequence267.mp4' + }, + { + duration: 4.00008, + map: { + uri: 'init.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'fileSequence268.mp4' + }, + { + duration: 4.00008, + map: { + uri: 'init.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'fileSequence269.mp4' + }, + { + duration: 4.00008, + map: { + uri: 'init.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'fileSequence270.mp4' + }, + { + duration: 4.00008, + map: { + uri: 'init.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'fileSequence271.mp4', + parts: [ + { + duration: 0.33334, + uri: 'filePart271.0.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.1.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.2.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.3.mp4' + }, + { + duration: 0.33334, + independent: true, + uri: 'filePart271.4.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.5.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.6.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.7.mp4' + }, + { + duration: 0.33334, + independent: true, + uri: 'filePart271.8.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.9.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.10.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.11.mp4' + } + ] + }, + { + dateTimeObject: new Date('2019-02-14T02:14:00.106Z'), + dateTimeString: '2019-02-14T02:14:00.106Z', + duration: 4.00008, + map: { + uri: 'init.mp4' + }, + raw: undefined, + timeline: 0, + uri: 'fileSequence272.mp4', + parts: [ + { + duration: 0.33334, + gap: true, + uri: 'filePart272.a.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.b.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.c.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.d.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.e.mp4' + }, + { + duration: 0.33334, + independent: true, + uri: 'filePart272.f.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.g.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.h.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.i.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.j.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.k.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.l.mp4' + } + ] + } + ], + serverControl: { + canSkipDateranges: true, + canBlockReload: true, + canSkipUntil: 12, + partHoldBack: 1, + holdBack: 12 + }, + targetDuration: 4, + version: 6 +}; diff --git a/test/fixtures/integration/without-raw/llhls.m3u8 b/test/fixtures/integration/without-raw/llhls.m3u8 new file mode 100644 index 0000000..40fe352 --- /dev/null +++ b/test/fixtures/integration/without-raw/llhls.m3u8 @@ -0,0 +1,56 @@ +#EXTM3U +# This Playlist is a response to: GET https://example.com/2M/waitForMSN.php?_HLS_msn=273&_HLS_part=2 +#EXT-X-TARGETDURATION:4 +#EXT-X-VERSION:6 +#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,CAN-SKIP-DATERANGES=YES,PART-HOLD-BACK=1.0,CAN-SKIP-UNTIL=12.0,HOLD-BACK=12.0 +#EXT-X-PART-INF:PART-TARGET=0.33334 +#EXT-X-MEDIA-SEQUENCE:266 +#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:13:36.106Z +#EXT-X-MAP:URI="init.mp4" +#EXTINF:4.00008, +fileSequence266.mp4 +#EXTINF:4.00008, +fileSequence267.mp4 +#EXTINF:4.00008, +fileSequence268.mp4 +#EXTINF:4.00008, +fileSequence269.mp4 +#EXTINF:4.00008, +fileSequence270.mp4 +#EXT-X-PART:DURATION=0.33334,URI="filePart271.0.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.1.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.2.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.3.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.4.mp4",INDEPENDENT=YES +#EXT-X-PART:DURATION=0.33334,URI="filePart271.5.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.6.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.7.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.8.mp4",INDEPENDENT=YES +#EXT-X-PART:DURATION=0.33334,URI="filePart271.9.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.10.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.11.mp4" +#EXTINF:4.00008, +fileSequence271.mp4 +#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:14:00.106Z +#EXT-X-PART:GAP=YES,DURATION=0.33334,URI="filePart272.a.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.b.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.c.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.d.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.e.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.f.mp4",INDEPENDENT=YES +#EXT-X-PART:DURATION=0.33334,URI="filePart272.g.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.h.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.i.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.j.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.k.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.l.mp4" +#EXTINF:4.00008, +fileSequence272.mp4 +#EXT-X-PART:DURATION=0.33334,URI="filePart273.0.mp4",INDEPENDENT=YES +#EXT-X-PART:DURATION=0.33334,URI="filePart273.1.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart273.2.mp4" +#EXT-X-PRELOAD-HINT:TYPE=PART,URI="filePart273.3.mp4" +#EXT-X-PRELOAD-HINT:TYPE=MAP,URI="file-init.mp4" + +#EXT-X-RENDITION-REPORT:URI="../1M/waitForMSN.php",LAST-MSN=273,LAST-PART=2 +#EXT-X-RENDITION-REPORT:URI="../4M/waitForMSN.php",LAST-MSN=273,LAST-PART=1 diff --git a/test/fixtures/integration/without-raw/llhlsDelta.js b/test/fixtures/integration/without-raw/llhlsDelta.js new file mode 100644 index 0000000..17e4175 --- /dev/null +++ b/test/fixtures/integration/without-raw/llhlsDelta.js @@ -0,0 +1,191 @@ +module.exports = { + allowCache: true, + dateTimeObject: new Date('2019-02-14T02:14:00.106Z'), + dateTimeString: '2019-02-14T02:14:00.106Z', + discontinuitySequence: 0, + discontinuityStarts: [], + mediaSequence: 266, + preloadSegment: { + raw: undefined, + timeline: 0, + preloadHints: [ + {type: 'PART', uri: 'filePart273.4.mp4'}, + {type: 'MAP', uri: 'file-init.mp4'} + ], + parts: [ + { + duration: 0.33334, + independent: true, + uri: 'filePart273.0.mp4' + }, + { + duration: 0.33334, + uri: 'filePart273.1.mp4' + }, + { + duration: 0.33334, + uri: 'filePart273.2.mp4' + }, + { + duration: 0.33334, + uri: 'filePart273.3.mp4' + } + ] + }, + renditionReports: [ + {lastMsn: 273, lastPart: 3, uri: '../1M/waitForMSN.php'}, + {lastMsn: 273, lastPart: 3, uri: '../4M/waitForMSN.php'} + ], + partInf: { + partTarget: 0.33334 + }, + partTargetDuration: 0.33334, + segments: [ + { + duration: 4.00008, + raw: undefined, + timeline: 0, + uri: 'fileSequence269.mp4' + }, + { + duration: 4.00008, + raw: undefined, + timeline: 0, + uri: 'fileSequence270.mp4' + }, + { + duration: 4.00008, + raw: undefined, + timeline: 0, + uri: 'fileSequence271.mp4', + parts: [ + { + duration: 0.33334, + uri: 'filePart271.0.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.1.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.2.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.3.mp4' + }, + { + duration: 0.33334, + independent: true, + uri: 'filePart271.4.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.5.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.6.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.7.mp4' + }, + { + duration: 0.33334, + independent: true, + uri: 'filePart271.8.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.9.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.10.mp4' + }, + { + duration: 0.33334, + uri: 'filePart271.11.mp4' + } + ] + }, + { + dateTimeObject: new Date('2019-02-14T02:14:00.106Z'), + dateTimeString: '2019-02-14T02:14:00.106Z', + duration: 4.00008, + raw: undefined, + timeline: 0, + uri: 'fileSequence272.mp4', + parts: [ + { + duration: 0.33334, + gap: true, + uri: 'filePart272.a.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.b.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.c.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.d.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.e.mp4' + }, + { + duration: 0.33334, + independent: true, + uri: 'filePart272.f.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.g.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.h.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.i.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.j.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.k.mp4' + }, + { + duration: 0.33334, + uri: 'filePart272.l.mp4' + } + ] + } + ], + skip: { + skippedSegments: 3, + recentlyRemovedDateranges: [ + 'foo', + 'bar' + ] + }, + serverControl: { + canSkipDateranges: true, + canBlockReload: true, + canSkipUntil: 12, + partHoldBack: 1, + holdBack: 12 + }, + targetDuration: 4, + version: 9 +}; diff --git a/test/fixtures/integration/without-raw/llhlsDelta.m3u8 b/test/fixtures/integration/without-raw/llhlsDelta.m3u8 new file mode 100644 index 0000000..2aedcdb --- /dev/null +++ b/test/fixtures/integration/without-raw/llhlsDelta.m3u8 @@ -0,0 +1,50 @@ +#EXTM3U +# Following the example above, this Playlist is a response to: GET https://example.com/2M/waitForMSN.php?_HLS_msn=273&_HLS_part=3 &_HLS_skip=YES +#EXT-X-TARGETDURATION:4 +#EXT-X-VERSION:9 +#EXT-X-SERVER-CONTROL:CAN-BLOCK-RELOAD=YES,CAN-SKIP-DATERANGES=YES,PART-HOLD-BACK=1.0,CAN-SKIP-UNTIL=12.0,HOLD-BACK=12.0 +#EXT-X-PART-INF:PART-TARGET=0.33334 +#EXT-X-MEDIA-SEQUENCE:266 +#EXT-X-SKIP:SKIPPED-SEGMENTS=3,RECENTLY-REMOVED-DATERANGES=foo bar +#EXTINF:4.00008, +fileSequence269.mp4 +#EXTINF:4.00008, +fileSequence270.mp4 +#EXT-X-PART:DURATION=0.33334,URI="filePart271.0.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.1.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.2.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.3.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.4.mp4",INDEPENDENT=YES +#EXT-X-PART:DURATION=0.33334,URI="filePart271.5.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.6.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.7.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.8.mp4",INDEPENDENT=YES +#EXT-X-PART:DURATION=0.33334,URI="filePart271.9.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.10.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart271.11.mp4" +#EXTINF:4.00008, +fileSequence271.mp4 +#EXT-X-PROGRAM-DATE-TIME:2019-02-14T02:14:00.106Z +#EXT-X-PART:GAP=YES,DURATION=0.33334,URI="filePart272.a.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.b.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.c.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.d.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.e.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.f.mp4",INDEPENDENT=YES +#EXT-X-PART:DURATION=0.33334,URI="filePart272.g.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.h.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.i.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.j.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.k.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart272.l.mp4" +#EXTINF:4.00008, +fileSequence272.mp4 +#EXT-X-PART:DURATION=0.33334,URI="filePart273.0.mp4",INDEPENDENT=YES +#EXT-X-PART:DURATION=0.33334,URI="filePart273.1.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart273.2.mp4" +#EXT-X-PART:DURATION=0.33334,URI="filePart273.3.mp4" +#EXT-X-PRELOAD-HINT:TYPE=PART,URI="filePart273.4.mp4" +#EXT-X-PRELOAD-HINT:TYPE=MAP,URI="file-init.mp4" + +#EXT-X-RENDITION-REPORT:URI="../1M/waitForMSN.php",LAST-MSN=273,LAST-PART=3 +#EXT-X-RENDITION-REPORT:URI="../4M/waitForMSN.php",LAST-MSN=273,LAST-PART=3 diff --git a/test/fixtures/integration/without-raw/manifestExtTTargetdurationNegative.js b/test/fixtures/integration/without-raw/manifestExtTTargetdurationNegative.js new file mode 100644 index 0000000..59b2d95 --- /dev/null +++ b/test/fixtures/integration/without-raw/manifestExtTTargetdurationNegative.js @@ -0,0 +1,15 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/gogo/00001.ts' + } + ], + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/manifestExtTTargetdurationNegative.m3u8 b/test/fixtures/integration/without-raw/manifestExtTTargetdurationNegative.m3u8 new file mode 100644 index 0000000..7b3d10e --- /dev/null +++ b/test/fixtures/integration/without-raw/manifestExtTTargetdurationNegative.m3u8 @@ -0,0 +1,5 @@ +#EXTM3U +#EXT-X-TARGETDURATION:-10 +#EXTINF:10, +/test/ts-files/zencoder/gogo/00001.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/manifestExtXEndlistEarly.js b/test/fixtures/integration/without-raw/manifestExtXEndlistEarly.js new file mode 100644 index 0000000..964dee0 --- /dev/null +++ b/test/fixtures/integration/without-raw/manifestExtXEndlistEarly.js @@ -0,0 +1,40 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/gogo/00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/gogo/00002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/gogo/00003.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/gogo/00004.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/gogo/00005.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/manifestExtXEndlistEarly.m3u8 b/test/fixtures/integration/without-raw/manifestExtXEndlistEarly.m3u8 new file mode 100644 index 0000000..dd19745 --- /dev/null +++ b/test/fixtures/integration/without-raw/manifestExtXEndlistEarly.m3u8 @@ -0,0 +1,14 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXTINF:10, +/test/ts-files/zencoder/gogo/00001.ts +#EXTINF:10, +/test/ts-files/zencoder/gogo/00002.ts +#EXTINF:10, +/test/ts-files/zencoder/gogo/00003.ts +#EXT-X-ENDLIST +#EXTINF:10, +/test/ts-files/zencoder/gogo/00004.ts +#EXTINF:10, +/test/ts-files/zencoder/gogo/00005.ts + diff --git a/test/fixtures/integration/without-raw/manifestNoExtM3u.js b/test/fixtures/integration/without-raw/manifestNoExtM3u.js new file mode 100644 index 0000000..001a5bd --- /dev/null +++ b/test/fixtures/integration/without-raw/manifestNoExtM3u.js @@ -0,0 +1,16 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/zencoder/gogo/00001.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/manifestNoExtM3u.m3u8 b/test/fixtures/integration/without-raw/manifestNoExtM3u.m3u8 new file mode 100644 index 0000000..2058c16 --- /dev/null +++ b/test/fixtures/integration/without-raw/manifestNoExtM3u.m3u8 @@ -0,0 +1,4 @@ +#EXT-X-TARGETDURATION:10 +#EXTINF:10, +/test/ts-files/zencoder/gogo/00001.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/master-fmp4.js b/test/fixtures/integration/without-raw/master-fmp4.js new file mode 100644 index 0000000..1b42878 --- /dev/null +++ b/test/fixtures/integration/without-raw/master-fmp4.js @@ -0,0 +1,489 @@ +module.exports = { + allowCache: true, + discontinuityStarts: [], + mediaGroups: { + 'AUDIO': { + aud1: { + English: { + autoselect: true, + default: true, + language: 'eng', + uri: 'a1/prog_index.m3u8' + } + }, + aud2: { + English: { + autoselect: true, + default: true, + language: 'eng', + uri: 'a2/prog_index.m3u8' + } + }, + aud3: { + English: { + autoselect: true, + default: true, + language: 'eng', + uri: 'a3/prog_index.m3u8' + } + } + }, + 'VIDEO': {}, + 'CLOSED-CAPTIONS': { + cc1: { + English: { + autoselect: true, + default: true, + language: 'eng', + instreamId: 'CC1' + } + } + }, + 'SUBTITLES': { + sub1: { + English: { + autoselect: true, + default: true, + language: 'eng', + uri: 's1/eng/prog_index.m3u8', + forced: false + } + } + } + }, + playlists: [{ + attributes: { + 'AVERAGE-BANDWIDTH': '2165224', + 'BANDWIDTH': 2215219, + 'CODECS': 'avc1.640020,mp4a.40.2', + 'RESOLUTION': { + width: 960, + height: 540 + }, + 'FRAME-RATE': '59.940', + 'CLOSED-CAPTIONS': 'cc1', + 'AUDIO': 'aud1', + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v4/prog_index.m3u8' + }, + + { + attributes: { + 'AUDIO': 'aud1', + 'AVERAGE-BANDWIDTH': '7962844', + 'BANDWIDTH': 7976430, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64002a,mp4a.40.2', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 1080, + width: 1920 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v8/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud1', + 'AVERAGE-BANDWIDTH': '6165024', + 'BANDWIDTH': 6181885, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64002a,mp4a.40.2', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 1080, + width: 1920 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v7/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud1', + 'AVERAGE-BANDWIDTH': '4664459', + 'BANDWIDTH': 4682666, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64002a,mp4a.40.2', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 1080, + width: 1920 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v6/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud1', + 'AVERAGE-BANDWIDTH': '3164759', + 'BANDWIDTH': 3170746, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.640020,mp4a.40.2', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 720, + width: 1280 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v5/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud1', + 'AVERAGE-BANDWIDTH': '1262552', + 'BANDWIDTH': 1276223, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64001e,mp4a.40.2', + 'FRAME-RATE': '29.970', + 'RESOLUTION': { + height: 432, + width: 768 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v3/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud1', + 'AVERAGE-BANDWIDTH': '893243', + 'BANDWIDTH': 904744, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64001e,mp4a.40.2', + 'FRAME-RATE': '29.970', + 'RESOLUTION': { + height: 360, + width: 640 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v2/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud1', + 'AVERAGE-BANDWIDTH': '527673', + 'BANDWIDTH': 538201, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.640015,mp4a.40.2', + 'FRAME-RATE': '29.970', + 'RESOLUTION': { + height: 270, + width: 480 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v1/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud2', + 'AVERAGE-BANDWIDTH': '2390334', + 'BANDWIDTH': 2440329, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.640020,ac-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 540, + width: 960 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v4/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud2', + 'AVERAGE-BANDWIDTH': '8187954', + 'BANDWIDTH': 8201540, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64002a,ac-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 1080, + width: 1920 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v8/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud2', + 'AVERAGE-BANDWIDTH': '6390134', + 'BANDWIDTH': 6406995, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64002a,ac-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 1080, + width: 1920 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v7/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud2', + 'AVERAGE-BANDWIDTH': '4889569', + 'BANDWIDTH': 4907776, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64002a,ac-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 1080, + width: 1920 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v6/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud2', + 'AVERAGE-BANDWIDTH': '3389869', + 'BANDWIDTH': 3395856, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.640020,ac-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 720, + width: 1280 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v5/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud2', + 'AVERAGE-BANDWIDTH': '1487662', + 'BANDWIDTH': 1501333, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64001e,ac-3', + 'FRAME-RATE': '29.970', + 'RESOLUTION': { + height: 432, + width: 768 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v3/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud2', + 'AVERAGE-BANDWIDTH': '1118353', + 'BANDWIDTH': 1129854, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64001e,ac-3', + 'FRAME-RATE': '29.970', + 'RESOLUTION': { + height: 360, + width: 640 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v2/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud2', + 'AVERAGE-BANDWIDTH': '752783', + 'BANDWIDTH': 763311, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.640015,ac-3', + 'FRAME-RATE': '29.970', + 'RESOLUTION': { + height: 270, + width: 480 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v1/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud3', + 'AVERAGE-BANDWIDTH': '2198334', + 'BANDWIDTH': 2248329, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.640020,ec-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 540, + width: 960 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v4/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud3', + 'AVERAGE-BANDWIDTH': '7995954', + 'BANDWIDTH': 8009540, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64002a,ec-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 1080, + width: 1920 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v8/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud3', + 'AVERAGE-BANDWIDTH': '6198134', + 'BANDWIDTH': 6214995, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64002a,ec-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 1080, + width: 1920 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v7/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud3', + 'AVERAGE-BANDWIDTH': '4697569', + 'BANDWIDTH': 4715776, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64002a,ec-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 1080, + width: 1920 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v6/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud3', + 'AVERAGE-BANDWIDTH': '3197869', + 'BANDWIDTH': 3203856, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.640020,ec-3', + 'FRAME-RATE': '59.940', + 'RESOLUTION': { + height: 720, + width: 1280 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v5/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud3', + 'AVERAGE-BANDWIDTH': '1295662', + 'BANDWIDTH': 1309333, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64001e,ec-3', + 'FRAME-RATE': '29.970', + 'RESOLUTION': { + height: 432, + width: 768 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v3/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud3', + 'AVERAGE-BANDWIDTH': '926353', + 'BANDWIDTH': 937854, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.64001e,ec-3', + 'FRAME-RATE': '29.970', + 'RESOLUTION': { + height: 360, + width: 640 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v2/prog_index.m3u8' + }, + { + attributes: { + 'AUDIO': 'aud3', + 'AVERAGE-BANDWIDTH': '560783', + 'BANDWIDTH': 571311, + 'CLOSED-CAPTIONS': 'cc1', + 'CODECS': 'avc1.640015,ec-3', + 'FRAME-RATE': '29.970', + 'RESOLUTION': { + height: 270, + width: 480 + }, + 'SUBTITLES': 'sub1' + }, + raw: undefined, + timeline: 0, + uri: 'v1/prog_index.m3u8' + }], + segments: [], + version: 6 +}; diff --git a/test/fixtures/integration/without-raw/master-fmp4.m3u8 b/test/fixtures/integration/without-raw/master-fmp4.m3u8 new file mode 100644 index 0000000..8646943 --- /dev/null +++ b/test/fixtures/integration/without-raw/master-fmp4.m3u8 @@ -0,0 +1,76 @@ +#EXTM3U +#EXT-X-VERSION:6 +#EXT-X-INDEPENDENT-SEGMENTS + + +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud1",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="a1/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud2",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="a2/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud3",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="a3/prog_index.m3u8" + + +#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="sub1",NAME="English",LANGUAGE="eng",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,URI="s1/eng/prog_index.m3u8" + + +#EXT-X-MEDIA:TYPE=CLOSED-CAPTIONS,GROUP-ID="cc1",NAME="English",LANGUAGE="eng",DEFAULT=YES,AUTOSELECT=YES,INSTREAM-ID="CC1" + + +#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=163198,BANDWIDTH=166942,CODECS="avc1.64002a",RESOLUTION=1920x1080,URI="v6/iframe_index.m3u8" +#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=131314,BANDWIDTH=139041,CODECS="avc1.640020",RESOLUTION=1280x720,URI="v5/iframe_index.m3u8" +#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=100233,BANDWIDTH=101724,CODECS="avc1.640020",RESOLUTION=960x540,URI="v4/iframe_index.m3u8" +#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=81002,BANDWIDTH=84112,CODECS="avc1.64001e",RESOLUTION=768x432,URI="v3/iframe_index.m3u8" +#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=64987,BANDWIDTH=65835,CODECS="avc1.64001e",RESOLUTION=640x360,URI="v2/iframe_index.m3u8" +#EXT-X-I-FRAME-STREAM-INF:AVERAGE-BANDWIDTH=41547,BANDWIDTH=42106,CODECS="avc1.640015",RESOLUTION=480x270,URI="v1/iframe_index.m3u8" + + +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2165224,BANDWIDTH=2215219,CODECS="avc1.640020,mp4a.40.2",RESOLUTION=960x540,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" +v4/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=7962844,BANDWIDTH=7976430,CODECS="avc1.64002a,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" +v8/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6165024,BANDWIDTH=6181885,CODECS="avc1.64002a,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" +v7/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4664459,BANDWIDTH=4682666,CODECS="avc1.64002a,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" +v6/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3164759,BANDWIDTH=3170746,CODECS="avc1.640020,mp4a.40.2",RESOLUTION=1280x720,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" +v5/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1262552,BANDWIDTH=1276223,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=768x432,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" +v3/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=893243,BANDWIDTH=904744,CODECS="avc1.64001e,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" +v2/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=527673,BANDWIDTH=538201,CODECS="avc1.640015,mp4a.40.2",RESOLUTION=480x270,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud1",SUBTITLES="sub1" +v1/prog_index.m3u8 + + +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2390334,BANDWIDTH=2440329,CODECS="avc1.640020,ac-3",RESOLUTION=960x540,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" +v4/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=8187954,BANDWIDTH=8201540,CODECS="avc1.64002a,ac-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" +v8/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6390134,BANDWIDTH=6406995,CODECS="avc1.64002a,ac-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" +v7/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4889569,BANDWIDTH=4907776,CODECS="avc1.64002a,ac-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" +v6/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3389869,BANDWIDTH=3395856,CODECS="avc1.640020,ac-3",RESOLUTION=1280x720,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" +v5/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1487662,BANDWIDTH=1501333,CODECS="avc1.64001e,ac-3",RESOLUTION=768x432,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" +v3/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1118353,BANDWIDTH=1129854,CODECS="avc1.64001e,ac-3",RESOLUTION=640x360,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" +v2/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=752783,BANDWIDTH=763311,CODECS="avc1.640015,ac-3",RESOLUTION=480x270,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud2",SUBTITLES="sub1" +v1/prog_index.m3u8 + + +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=2198334,BANDWIDTH=2248329,CODECS="avc1.640020,ec-3",RESOLUTION=960x540,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" +v4/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=7995954,BANDWIDTH=8009540,CODECS="avc1.64002a,ec-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" +v8/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=6198134,BANDWIDTH=6214995,CODECS="avc1.64002a,ec-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" +v7/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=4697569,BANDWIDTH=4715776,CODECS="avc1.64002a,ec-3",RESOLUTION=1920x1080,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" +v6/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=3197869,BANDWIDTH=3203856,CODECS="avc1.640020,ec-3",RESOLUTION=1280x720,FRAME-RATE=59.940,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" +v5/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=1295662,BANDWIDTH=1309333,CODECS="avc1.64001e,ec-3",RESOLUTION=768x432,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" +v3/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=926353,BANDWIDTH=937854,CODECS="avc1.64001e,ec-3",RESOLUTION=640x360,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" +v2/prog_index.m3u8 +#EXT-X-STREAM-INF:AVERAGE-BANDWIDTH=560783,BANDWIDTH=571311,CODECS="avc1.640015,ec-3",RESOLUTION=480x270,FRAME-RATE=29.970,CLOSED-CAPTIONS="cc1",AUDIO="aud3",SUBTITLES="sub1" +v1/prog_index.m3u8 diff --git a/test/fixtures/integration/without-raw/master.js b/test/fixtures/integration/without-raw/master.js new file mode 100644 index 0000000..0f53388 --- /dev/null +++ b/test/fixtures/integration/without-raw/master.js @@ -0,0 +1,61 @@ +module.exports = { + allowCache: true, + playlists: [ + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 240000, + 'RESOLUTION': { + width: 396, + height: 224 + } + }, + raw: undefined, + timeline: 0, + uri: 'media.m3u8' + }, + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 40000 + }, + raw: undefined, + timeline: 0, + uri: 'media1.m3u8' + }, + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 440000, + 'RESOLUTION': { + width: 396, + height: 224 + } + }, + raw: undefined, + timeline: 0, + uri: 'media2.m3u8' + }, + { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 1928000, + 'RESOLUTION': { + width: 960, + height: 540 + } + }, + raw: undefined, + timeline: 0, + uri: 'media3.m3u8' + } + ], + discontinuityStarts: [], + mediaGroups: { + 'VIDEO': {}, + 'AUDIO': {}, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/master.m3u8 b/test/fixtures/integration/without-raw/master.m3u8 new file mode 100644 index 0000000..338f060 --- /dev/null +++ b/test/fixtures/integration/without-raw/master.m3u8 @@ -0,0 +1,10 @@ +# A simple master playlist with multiple variant streams +#EXTM3U +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000,RESOLUTION=396x224 +media.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=40000 +media1.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000,RESOLUTION=396x224 +media2.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1928000,RESOLUTION=960x540 +media3.m3u8 diff --git a/test/fixtures/integration/without-raw/media.js b/test/fixtures/integration/without-raw/media.js new file mode 100644 index 0000000..ec958cd --- /dev/null +++ b/test/fixtures/integration/without-raw/media.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'media-00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'media-00002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'media-00003.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'media-00004.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/media.m3u8 b/test/fixtures/integration/without-raw/media.m3u8 new file mode 100644 index 0000000..f191b7f --- /dev/null +++ b/test/fixtures/integration/without-raw/media.m3u8 @@ -0,0 +1,12 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-TARGETDURATION:10 +#EXTINF:10, +media-00001.ts +#EXTINF:10, +media-00002.ts +#EXTINF:10, +media-00003.ts +#EXTINF:10, +media-00004.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/mediaSequence.js b/test/fixtures/integration/without-raw/mediaSequence.js new file mode 100644 index 0000000..764b0d3 --- /dev/null +++ b/test/fixtures/integration/without-raw/mediaSequence.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + }, + { + duration: 6.08, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + }, + { + duration: 6.6, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + }, + { + duration: 5, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + } + ], + targetDuration: 8, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/mediaSequence.m3u8 b/test/fixtures/integration/without-raw/mediaSequence.m3u8 new file mode 100644 index 0000000..5c94847 --- /dev/null +++ b/test/fixtures/integration/without-raw/mediaSequence.m3u8 @@ -0,0 +1,14 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +#EXTINF:6.080,{} +/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts +#EXTINF:6.600,{} +/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts +#EXTINF:5.000,{} +/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/missingEndlist.js b/test/fixtures/integration/without-raw/missingEndlist.js new file mode 100644 index 0000000..aff0b3b --- /dev/null +++ b/test/fixtures/integration/without-raw/missingEndlist.js @@ -0,0 +1,21 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '00002.ts' + } + ], + targetDuration: 10, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/missingEndlist.m3u8 b/test/fixtures/integration/without-raw/missingEndlist.m3u8 new file mode 100644 index 0000000..7f9a186 --- /dev/null +++ b/test/fixtures/integration/without-raw/missingEndlist.m3u8 @@ -0,0 +1,6 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXTINF:10, +00001.ts +#EXTINF:10, +00002.ts diff --git a/test/fixtures/integration/without-raw/missingExtinf.js b/test/fixtures/integration/without-raw/missingExtinf.js new file mode 100644 index 0000000..c6d1c02 --- /dev/null +++ b/test/fixtures/integration/without-raw/missingExtinf.js @@ -0,0 +1,30 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 3 +}; diff --git a/test/fixtures/integration/without-raw/missingExtinf.m3u8 b/test/fixtures/integration/without-raw/missingExtinf.m3u8 new file mode 100644 index 0000000..e8a142c --- /dev/null +++ b/test/fixtures/integration/without-raw/missingExtinf.m3u8 @@ -0,0 +1,11 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:3 +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10 +hls_450k_video.ts +hls_450k_video.ts +#EXTINF:10, +hls_450k_video.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/missingMediaSequence.js b/test/fixtures/integration/without-raw/missingMediaSequence.js new file mode 100644 index 0000000..764b0d3 --- /dev/null +++ b/test/fixtures/integration/without-raw/missingMediaSequence.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + }, + { + duration: 6.08, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + }, + { + duration: 6.6, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + }, + { + duration: 5, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + } + ], + targetDuration: 8, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/missingMediaSequence.m3u8 b/test/fixtures/integration/without-raw/missingMediaSequence.m3u8 new file mode 100644 index 0000000..875b93e --- /dev/null +++ b/test/fixtures/integration/without-raw/missingMediaSequence.m3u8 @@ -0,0 +1,13 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +#EXTINF:6.080,{} +/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts +#EXTINF:6.600,{} +/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts +#EXTINF:5.000,{} +/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/missingSegmentDuration.js b/test/fixtures/integration/without-raw/missingSegmentDuration.js new file mode 100644 index 0000000..6aef453 --- /dev/null +++ b/test/fixtures/integration/without-raw/missingSegmentDuration.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + }, + { + duration: 8, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + }, + { + duration: 8, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + }, + { + duration: 8, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + } + ], + targetDuration: 8, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/missingSegmentDuration.m3u8 b/test/fixtures/integration/without-raw/missingSegmentDuration.m3u8 new file mode 100644 index 0000000..441934b --- /dev/null +++ b/test/fixtures/integration/without-raw/missingSegmentDuration.m3u8 @@ -0,0 +1,11 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts +/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts +/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/multipleAudioGroups.js b/test/fixtures/integration/without-raw/multipleAudioGroups.js new file mode 100644 index 0000000..4d9df41 --- /dev/null +++ b/test/fixtures/integration/without-raw/multipleAudioGroups.js @@ -0,0 +1,93 @@ +module.exports = { + allowCache: true, + discontinuityStarts: [], + mediaGroups: { + 'AUDIO': { + 'audio-lo': { + English: { + autoselect: true, + default: true, + language: 'eng', + uri: 'englo/prog_index.m3u8' + }, + Français: { + autoselect: true, + default: false, + language: 'fre', + uri: 'frelo/prog_index.m3u8' + }, + Espanol: { + autoselect: true, + default: false, + language: 'sp', + uri: 'splo/prog_index.m3u8' + } + }, + 'audio-hi': { + English: { + autoselect: true, + default: true, + language: 'eng', + uri: 'eng/prog_index.m3u8' + }, + Français: { + autoselect: true, + default: false, + language: 'fre', + uri: 'fre/prog_index.m3u8' + }, + Espanol: { + autoselect: true, + default: false, + language: 'sp', + uri: 'sp/prog_index.m3u8' + } + } + }, + 'VIDEO': {}, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + playlists: [{ + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 195023, + 'CODECS': 'mp4a.40.5', + 'AUDIO': 'audio-lo' + }, + raw: undefined, + timeline: 0, + uri: 'lo/prog_index.m3u8' + }, { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 260000, + 'CODECS': 'avc1.42e01e,mp4a.40.2', + 'AUDIO': 'audio-lo' + }, + raw: undefined, + timeline: 0, + uri: 'lo2/prog_index.m3u8' + }, { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 591680, + 'CODECS': 'mp4a.40.2, avc1.64001e', + 'AUDIO': 'audio-hi' + }, + raw: undefined, + timeline: 0, + uri: 'hi/prog_index.m3u8' + }, { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 650000, + 'CODECS': 'avc1.42e01e,mp4a.40.2', + 'AUDIO': 'audio-hi' + }, + raw: undefined, + timeline: 0, + uri: 'hi2/prog_index.m3u8' + }], + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/multipleAudioGroups.m3u8 b/test/fixtures/integration/without-raw/multipleAudioGroups.m3u8 new file mode 100644 index 0000000..c16a8ba --- /dev/null +++ b/test/fixtures/integration/without-raw/multipleAudioGroups.m3u8 @@ -0,0 +1,17 @@ +#EXTM3U +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES,URI="englo/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="frelo/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="splo/prog_index.m3u8" + +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES,URI="eng/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="fre/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="sp/prog_index.m3u8" + +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS="mp4a.40.5", AUDIO="audio-lo" +lo/prog_index.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=260000,CODECS="avc1.42e01e,mp4a.40.2", AUDIO="audio-lo" +lo2/prog_index.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS="mp4a.40.2, avc1.64001e", AUDIO="audio-hi" +hi/prog_index.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=650000,CODECS="avc1.42e01e,mp4a.40.2", AUDIO="audio-hi" +hi2/prog_index.m3u8 diff --git a/test/fixtures/integration/without-raw/multipleAudioGroupsCombinedMain.js b/test/fixtures/integration/without-raw/multipleAudioGroupsCombinedMain.js new file mode 100644 index 0000000..614700c --- /dev/null +++ b/test/fixtures/integration/without-raw/multipleAudioGroupsCombinedMain.js @@ -0,0 +1,92 @@ +module.exports = { + allowCache: true, + discontinuityStarts: [], + mediaGroups: { + 'AUDIO': { + 'audio-lo': { + English: { + autoselect: true, + default: true, + language: 'eng' + }, + Français: { + autoselect: true, + default: false, + language: 'fre', + uri: 'frelo/prog_index.m3u8' + }, + Espanol: { + autoselect: true, + default: false, + language: 'sp', + uri: 'splo/prog_index.m3u8' + } + }, + 'audio-hi': { + English: { + autoselect: true, + default: true, + language: 'eng', + uri: 'eng/prog_index.m3u8' + }, + Français: { + autoselect: true, + default: false, + language: 'fre', + uri: 'fre/prog_index.m3u8' + }, + Espanol: { + autoselect: true, + default: false, + language: 'sp', + uri: 'sp/prog_index.m3u8' + } + } + }, + 'VIDEO': {}, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + playlists: [{ + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 195023, + 'CODECS': 'mp4a.40.5', + 'AUDIO': 'audio-lo' + }, + raw: undefined, + timeline: 0, + uri: 'lo/prog_index.m3u8' + }, { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 260000, + 'CODECS': 'avc1.42e01e,mp4a.40.2', + 'AUDIO': 'audio-lo' + }, + raw: undefined, + timeline: 0, + uri: 'lo2/prog_index.m3u8' + }, { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 591680, + 'CODECS': 'mp4a.40.2, avc1.64001e', + 'AUDIO': 'audio-hi' + }, + raw: undefined, + timeline: 0, + uri: 'hi/prog_index.m3u8' + }, { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 650000, + 'CODECS': 'avc1.42e01e,mp4a.40.2', + 'AUDIO': 'audio-hi' + }, + raw: undefined, + timeline: 0, + uri: 'hi2/prog_index.m3u8' + }], + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/multipleAudioGroupsCombinedMain.m3u8 b/test/fixtures/integration/without-raw/multipleAudioGroupsCombinedMain.m3u8 new file mode 100644 index 0000000..f348428 --- /dev/null +++ b/test/fixtures/integration/without-raw/multipleAudioGroupsCombinedMain.m3u8 @@ -0,0 +1,17 @@ +#EXTM3U +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="frelo/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-lo",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="splo/prog_index.m3u8" + +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="eng",NAME="English",AUTOSELECT=YES, DEFAULT=YES,URI="eng/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="fre",NAME="Français",AUTOSELECT=YES, DEFAULT=NO,URI="fre/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-hi",LANGUAGE="sp",NAME="Espanol",AUTOSELECT=YES, DEFAULT=NO,URI="sp/prog_index.m3u8" + +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=195023,CODECS="mp4a.40.5", AUDIO="audio-lo" +lo/prog_index.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=260000,CODECS="avc1.42e01e,mp4a.40.2", AUDIO="audio-lo" +lo2/prog_index.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=591680,CODECS="mp4a.40.2, avc1.64001e", AUDIO="audio-hi" +hi/prog_index.m3u8 +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=650000,CODECS="avc1.42e01e,mp4a.40.2", AUDIO="audio-hi" +hi2/prog_index.m3u8 diff --git a/test/fixtures/integration/without-raw/multipleTargetDurations.js b/test/fixtures/integration/without-raw/multipleTargetDurations.js new file mode 100644 index 0000000..8a2f92d --- /dev/null +++ b/test/fixtures/integration/without-raw/multipleTargetDurations.js @@ -0,0 +1,32 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + targetDuration: 10, + segments: [ + { + uri: '001.ts', + raw: undefined, + timeline: 0 + }, + { + uri: '002.ts', + duration: 9, + raw: undefined, + timeline: 0 + }, + { + uri: '003.ts', + duration: 7, + raw: undefined, + timeline: 0 + }, + { + uri: '004.ts', + duration: 10, + raw: undefined, + timeline: 0 + } + ], + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/multipleTargetDurations.m3u8 b/test/fixtures/integration/without-raw/multipleTargetDurations.m3u8 new file mode 100644 index 0000000..9898ce6 --- /dev/null +++ b/test/fixtures/integration/without-raw/multipleTargetDurations.m3u8 @@ -0,0 +1,8 @@ +#EXTM3U +001.ts +#EXT-X-TARGETDURATION:9 +002.ts +#EXTINF:7 +003.ts +#EXT-X-TARGETDURATION:10 +004.ts \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/multipleVideo.js b/test/fixtures/integration/without-raw/multipleVideo.js new file mode 100644 index 0000000..f63f0f3 --- /dev/null +++ b/test/fixtures/integration/without-raw/multipleVideo.js @@ -0,0 +1,76 @@ +module.exports = { + allowCache: true, + discontinuityStarts: [], + mediaGroups: { + 'AUDIO': { + aac: { + English: { + autoselect: true, + default: true, + language: 'eng', + uri: 'eng/prog_index.m3u8' + } + } + }, + 'VIDEO': { + '200kbs': { + Angle1: { + autoselect: true, + default: true + }, + Angle2: { + autoselect: true, + default: false, + uri: 'Angle2/200kbs/prog_index.m3u8' + }, + Angle3: { + autoselect: true, + default: false, + uri: 'Angle3/200kbs/prog_index.m3u8' + } + }, + '500kbs': { + Angle1: { + autoselect: true, + default: true + }, + Angle2: { + autoselect: true, + default: false, + uri: 'Angle2/500kbs/prog_index.m3u8' + }, + Angle3: { + autoselect: true, + default: false, + uri: 'Angle3/500kbs/prog_index.m3u8' + } + } + }, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + playlists: [{ + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 300000, + 'CODECS': 'mp4a.40.2,avc1.4d401e', + 'AUDIO': 'aac', + 'VIDEO': '200kbs' + }, + raw: undefined, + timeline: 0, + uri: 'Angle1/200kbs/prog_index.m3u' + }, { + attributes: { + 'PROGRAM-ID': 1, + 'BANDWIDTH': 754857, + 'CODECS': 'mp4a.40.2,avc1.4d401e', + 'AUDIO': 'aac', + 'VIDEO': '500kbs' + }, + raw: undefined, + timeline: 0, + uri: 'Angle1/500kbs/prog_index.m3u8' + }], + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/multipleVideo.m3u8 b/test/fixtures/integration/without-raw/multipleVideo.m3u8 new file mode 100644 index 0000000..ad9695e --- /dev/null +++ b/test/fixtures/integration/without-raw/multipleVideo.m3u8 @@ -0,0 +1,16 @@ +#EXTM3U +#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="200kbs",NAME="Angle1",AUTOSELECT=YES,DEFAULT=YES +#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="200kbs",NAME="Angle2",AUTOSELECT=YES,DEFAULT=NO,URI="Angle2/200kbs/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="200kbs",NAME="Angle3",AUTOSELECT=YES,DEFAULT=NO,URI="Angle3/200kbs/prog_index.m3u8" + +#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle1",AUTOSELECT=YES,DEFAULT=YES +#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle2",AUTOSELECT=YES,DEFAULT=NO,URI="Angle2/500kbs/prog_index.m3u8" +#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="500kbs",NAME="Angle3",AUTOSELECT=YES,DEFAULT=NO,URI="Angle3/500kbs/prog_index.m3u8" + +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="eng",NAME="English",AUTOSELECT=YES,DEFAULT=YES,URI="eng/prog_index.m3u8" + +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=300000,CODECS="mp4a.40.2,avc1.4d401e",VIDEO="200kbs",AUDIO="aac" +Angle1/200kbs/prog_index.m3u + +#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=754857,CODECS="mp4a.40.2,avc1.4d401e",VIDEO="500kbs",AUDIO="aac" +Angle1/500kbs/prog_index.m3u8 \ No newline at end of file diff --git a/test/fixtures/integration/without-raw/negativeMediaSequence.js b/test/fixtures/integration/without-raw/negativeMediaSequence.js new file mode 100644 index 0000000..e6202b6 --- /dev/null +++ b/test/fixtures/integration/without-raw/negativeMediaSequence.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: -11, + playlistType: 'VOD', + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + }, + { + duration: 6.08, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + }, + { + duration: 6.6, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + }, + { + duration: 5, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + } + ], + targetDuration: 8, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/negativeMediaSequence.m3u8 b/test/fixtures/integration/without-raw/negativeMediaSequence.m3u8 new file mode 100644 index 0000000..4af6186 --- /dev/null +++ b/test/fixtures/integration/without-raw/negativeMediaSequence.m3u8 @@ -0,0 +1,14 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MEDIA-SEQUENCE:-11 +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +#EXTINF:6.080,{} +/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts +#EXTINF:6.600,{} +/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts +#EXTINF:5.000,{} +/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/playlist.js b/test/fixtures/integration/without-raw/playlist.js new file mode 100644 index 0000000..141d1a2 --- /dev/null +++ b/test/fixtures/integration/without-raw/playlist.js @@ -0,0 +1,182 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + byterange: { + length: 522828, + offset: 0 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 587500, + offset: 522828 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 713084, + offset: 1110328 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 476580, + offset: 1823412 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 535612, + offset: 2299992 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 207176, + offset: 2835604 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 455900, + offset: 3042780 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 657248, + offset: 3498680 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 571708, + offset: 4155928 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 485040, + offset: 4727636 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 709136, + offset: 5212676 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 730004, + offset: 5921812 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 456276, + offset: 6651816 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 468684, + offset: 7108092 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 444996, + offset: 7576776 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 331444, + offset: 8021772 + }, + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + }, + { + byterange: { + length: 44556, + offset: 8353216 + }, + duration: 1.4167, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + version: 4 +}; diff --git a/test/fixtures/integration/without-raw/playlist.m3u8 b/test/fixtures/integration/without-raw/playlist.m3u8 new file mode 100644 index 0000000..b1060b6 --- /dev/null +++ b/test/fixtures/integration/without-raw/playlist.m3u8 @@ -0,0 +1,57 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:4 +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +#EXT-X-BYTERANGE:522828@0 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:587500@522828 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:713084@1110328 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:476580@1823412 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:535612@2299992 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:207176@2835604 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:455900@3042780 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:657248@3498680 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:571708@4155928 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:485040@4727636 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:709136@5212676 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:730004@5921812 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:456276@6651816 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:468684@7108092 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:444996@7576776 +hls_450k_video.ts +#EXTINF:10, +#EXT-X-BYTERANGE:331444@8021772 +hls_450k_video.ts +#EXTINF:1.4167, +#EXT-X-BYTERANGE:44556@8353216 +hls_450k_video.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/playlistMediaSequenceHigher.js b/test/fixtures/integration/without-raw/playlistMediaSequenceHigher.js new file mode 100644 index 0000000..4c7b9fc --- /dev/null +++ b/test/fixtures/integration/without-raw/playlistMediaSequenceHigher.js @@ -0,0 +1,17 @@ +module.exports = { + allowCache: true, + mediaSequence: 17, + playlistType: 'VOD', + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + } + ], + targetDuration: 8, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/playlistMediaSequenceHigher.m3u8 b/test/fixtures/integration/without-raw/playlistMediaSequenceHigher.m3u8 new file mode 100644 index 0000000..01aeac7 --- /dev/null +++ b/test/fixtures/integration/without-raw/playlistMediaSequenceHigher.m3u8 @@ -0,0 +1,8 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MEDIA-SEQUENCE:17 +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/start.js b/test/fixtures/integration/without-raw/start.js new file mode 100644 index 0000000..2babb1b --- /dev/null +++ b/test/fixtures/integration/without-raw/start.js @@ -0,0 +1,40 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'media-00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'media-00002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'media-00003.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'media-00004.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [], + start: { + timeOffset: 10.3, + precise: false + }, + version: 3 +}; diff --git a/test/fixtures/integration/without-raw/start.m3u8 b/test/fixtures/integration/without-raw/start.m3u8 new file mode 100644 index 0000000..d340b90 --- /dev/null +++ b/test/fixtures/integration/without-raw/start.m3u8 @@ -0,0 +1,13 @@ +#EXT-X-VERSION:3 +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-TARGETDURATION:10 +#EXT-X-START:TIME-OFFSET=10.3 +#EXTINF:10, +media-00001.ts +#EXTINF:10, +media-00002.ts +#EXTINF:10, +media-00003.ts +#EXTINF:10, +media-00004.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/streamInfInvalid.js b/test/fixtures/integration/without-raw/streamInfInvalid.js new file mode 100644 index 0000000..a49d046 --- /dev/null +++ b/test/fixtures/integration/without-raw/streamInfInvalid.js @@ -0,0 +1,26 @@ +module.exports = { + allowCache: true, + playlists: [ + { + attributes: { + 'PROGRAM-ID': 1 + }, + raw: undefined, + timeline: 0, + uri: 'media.m3u8' + }, + { + raw: undefined, + timeline: 0, + uri: 'media1.m3u8' + } + ], + discontinuityStarts: [], + mediaGroups: { + 'VIDEO': {}, + 'AUDIO': {}, + 'CLOSED-CAPTIONS': {}, + 'SUBTITLES': {} + }, + segments: [] +}; diff --git a/test/fixtures/integration/without-raw/streamInfInvalid.m3u8 b/test/fixtures/integration/without-raw/streamInfInvalid.m3u8 new file mode 100644 index 0000000..37deba4 --- /dev/null +++ b/test/fixtures/integration/without-raw/streamInfInvalid.m3u8 @@ -0,0 +1,6 @@ +# A simple master playlist with multiple variant streams +#EXTM3U +#EXT-X-STREAM-INF:PROGRAM-ID=1 +media.m3u8 +#EXT-X-STREAM-INF: +media1.m3u8 diff --git a/test/fixtures/integration/without-raw/twoMediaSequences.js b/test/fixtures/integration/without-raw/twoMediaSequences.js new file mode 100644 index 0000000..0e7d55f --- /dev/null +++ b/test/fixtures/integration/without-raw/twoMediaSequences.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 11, + playlistType: 'VOD', + segments: [ + { + duration: 6.64, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts' + }, + { + duration: 6.08, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts' + }, + { + duration: 6.6, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts' + }, + { + duration: 5, + raw: undefined, + timeline: 0, + uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts' + } + ], + targetDuration: 8, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/twoMediaSequences.m3u8 b/test/fixtures/integration/without-raw/twoMediaSequences.m3u8 new file mode 100644 index 0000000..bf802f9 --- /dev/null +++ b/test/fixtures/integration/without-raw/twoMediaSequences.m3u8 @@ -0,0 +1,15 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-MEDIA-SEQUENCE:11 +#EXT-X-ALLOW-CACHE:YES +#EXT-X-TARGETDURATION:8 +#EXTINF:6.640,{} +/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts +#EXTINF:6.080,{} +/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts +#EXTINF:6.600,{} +/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts +#EXTINF:5.000,{} +/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/versionInvalid.js b/test/fixtures/integration/without-raw/versionInvalid.js new file mode 100644 index 0000000..46a8915 --- /dev/null +++ b/test/fixtures/integration/without-raw/versionInvalid.js @@ -0,0 +1,17 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'hls_450k_video.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/versionInvalid.m3u8 b/test/fixtures/integration/without-raw/versionInvalid.m3u8 new file mode 100644 index 0000000..53c1bb2 --- /dev/null +++ b/test/fixtures/integration/without-raw/versionInvalid.m3u8 @@ -0,0 +1,8 @@ +#EXTM3U +#EXT-X-TARGETDURATION:10 +#EXT-X-VERSION:NaN +#EXT-X-MEDIA-SEQUENCE:0 +#EXT-X-PLAYLIST-TYPE:VOD +#EXTINF:10, +hls_450k_video.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/whiteSpace.js b/test/fixtures/integration/without-raw/whiteSpace.js new file mode 100644 index 0000000..537b779 --- /dev/null +++ b/test/fixtures/integration/without-raw/whiteSpace.js @@ -0,0 +1,35 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'http://example.com/00001.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'https://example.com/00002.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: '//example.com/00003.ts' + }, + { + duration: 10, + raw: undefined, + timeline: 0, + uri: 'http://example.com/00004.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/whiteSpace.m3u8 b/test/fixtures/integration/without-raw/whiteSpace.m3u8 new file mode 100644 index 0000000..62e0c4c --- /dev/null +++ b/test/fixtures/integration/without-raw/whiteSpace.m3u8 @@ -0,0 +1,13 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-TARGETDURATION:10 + +#EXTINF:10, +http://example.com/00001.ts +#EXTINF:10, + https://example.com/00002.ts +#EXTINF:10, + //example.com/00003.ts +#EXTINF:10, + http://example.com/00004.ts +#EXT-X-ENDLIST diff --git a/test/fixtures/integration/without-raw/zeroDuration.js b/test/fixtures/integration/without-raw/zeroDuration.js new file mode 100644 index 0000000..e58d9eb --- /dev/null +++ b/test/fixtures/integration/without-raw/zeroDuration.js @@ -0,0 +1,17 @@ +module.exports = { + allowCache: true, + mediaSequence: 0, + playlistType: 'VOD', + segments: [ + { + duration: 0.01, + raw: undefined, + timeline: 0, + uri: 'http://example.com/00001.ts' + } + ], + targetDuration: 10, + endList: true, + discontinuitySequence: 0, + discontinuityStarts: [] +}; diff --git a/test/fixtures/integration/without-raw/zeroDuration.m3u8 b/test/fixtures/integration/without-raw/zeroDuration.m3u8 new file mode 100644 index 0000000..2245b98 --- /dev/null +++ b/test/fixtures/integration/without-raw/zeroDuration.m3u8 @@ -0,0 +1,7 @@ +#EXTM3U +#EXT-X-PLAYLIST-TYPE:VOD +#EXT-X-TARGETDURATION:10 + +#EXTINF:0, +http://example.com/00001.ts +#EXT-X-ENDLIST diff --git a/test/parse-stream.test.js b/test/parse-stream.test.js index 3c221ca..e216bd9 100644 --- a/test/parse-stream.test.js +++ b/test/parse-stream.test.js @@ -5,8 +5,11 @@ import sinon from 'sinon'; QUnit.module('ParseStream', { beforeEach() { this.lineStream = new LineStream(); + this.lineStreamReturnRaw = new LineStream(); this.parseStream = new ParseStream(); + this.parseStreamReturnRaw = new ParseStream(true); this.lineStream.pipe(this.parseStream); + this.lineStreamReturnRaw.pipe(this.parseStreamReturnRaw); } }); @@ -64,6 +67,56 @@ QUnit.test('mapper does not conflict with parser', function(assert) { assert.ok(commentMapper2.called); assert.strictEqual(dataCallback.callCount, 3); + assert.deepEqual(dataCallback.getCall(0).args[0], { + data: '#EXAMPLE', + type: 'custom', + customType: 'test', + segment: undefined + }); + assert.deepEqual(dataCallback.getCall(1).args[0], { + data: '#NEW-COMMENT', + type: 'custom', + customType: 'test2', + segment: undefined + }); + assert.deepEqual(dataCallback.getCall(2).args[0], { + text: 'SOMETHING-ELSE', + type: 'comment', + raw: undefined + }); +}); + +QUnit.test('mapper does not conflict with parser and returns raw', function(assert) { + const manifest = '#EXAMPLE\n'; + const commentMapper = sinon.spy(line => '#NEW-COMMENT'); + const commentMapper2 = sinon.spy(line => '#SOMETHING-ELSE'); + const dataCallback = sinon.spy(); + + this.parseStreamReturnRaw.addTagMapper({ + expression: /^#EXAMPLE/, + map: commentMapper + }); + this.parseStreamReturnRaw.addTagMapper({ + expression: /^#EXAMPLE/, + map: commentMapper2 + }); + + this.parseStreamReturnRaw.addParser({ + expression: /^#EXAMPLE/, + customType: 'test' + }); + this.parseStreamReturnRaw.addParser({ + expression: /^#NEW-COMMENT/, + customType: 'test2' + }); + + this.parseStreamReturnRaw.on('data', dataCallback); + this.lineStreamReturnRaw.push(manifest); + + assert.ok(commentMapper.called); + assert.ok(commentMapper2.called); + assert.strictEqual(dataCallback.callCount, 3); + assert.deepEqual(dataCallback.getCall(0).args[0], { data: '#EXAMPLE', type: 'custom', @@ -99,6 +152,34 @@ QUnit.test('maps custom tags', function(assert) { assert.ok(commentMapper.called); assert.strictEqual(dataCallback.callCount, 2); + assert.deepEqual(dataCallback.getCall(0).args[0], { + text: 'EXAMPLE', + type: 'comment', + raw: undefined + }); + assert.deepEqual(dataCallback.getCall(1).args[0], { + text: 'NEW-COMMENT', + type: 'comment', + raw: undefined + }); +}); + +QUnit.test('maps custom tags and returns raw', function(assert) { + const manifest = '#EXAMPLE\n'; + const commentMapper = sinon.spy(line => '#NEW-COMMENT'); + const dataCallback = sinon.spy(); + + this.parseStreamReturnRaw.addTagMapper({ + expression: /^#EXAMPLE/, + map: commentMapper + }); + + this.parseStreamReturnRaw.on('data', dataCallback); + this.lineStreamReturnRaw.push(manifest); + + assert.ok(commentMapper.called); + assert.strictEqual(dataCallback.callCount, 2); + assert.deepEqual(dataCallback.getCall(0).args[0], { text: 'EXAMPLE', type: 'comment', @@ -138,6 +219,52 @@ QUnit.test('maps multiple custom tags', function(assert) { assert.ok(pdtMapper.called); assert.strictEqual(dataCallback.callCount, 3); + assert.deepEqual(dataCallback.getCall(0).args[0], { + text: 'VOD-STARTTIMESTAMP:1501533337573', + type: 'comment', + raw: undefined + }); + + assert.deepEqual(dataCallback.getCall(1).args[0], { + text: 'NEW-COMMENT', + type: 'comment', + raw: undefined + }); + + const dateTag = dataCallback.getCall(2).args[0]; + + assert.strictEqual(dateTag.dateTimeString, '2017-07-31T20:35:37.573Z'); + assert.strictEqual(dateTag.tagType, 'program-date-time'); + assert.strictEqual(dateTag.type, 'tag'); +}); + +QUnit.test('maps multiple custom tags and returns raw', function(assert) { + const manifest = '#VOD-STARTTIMESTAMP:1501533337573\n'; + const commentMapper = sinon.spy(line => '#NEW-COMMENT'); + const pdtMapper = sinon.spy((line) => { + const match = /#VOD-STARTTIMESTAMP:(\d+)/g.exec(line)[1]; + const ISOdate = new Date(Number(match)).toISOString(); + + return `#EXT-X-PROGRAM-DATE-TIME:${ISOdate}`; + }); + const dataCallback = sinon.spy(); + + this.parseStreamReturnRaw.addTagMapper({ + expression: /^#VOD-STARTTIMESTAMP/, + map: commentMapper + }); + this.parseStreamReturnRaw.addTagMapper({ + expression: /^#VOD-STARTTIMESTAMP/, + map: pdtMapper + }); + + this.parseStreamReturnRaw.on('data', dataCallback); + this.lineStreamReturnRaw.push(manifest); + + assert.ok(commentMapper.called); + assert.ok(pdtMapper.called); + assert.strictEqual(dataCallback.callCount, 3); + assert.deepEqual(dataCallback.getCall(0).args[0], { text: 'VOD-STARTTIMESTAMP:1501533337573', type: 'comment', @@ -171,6 +298,28 @@ QUnit.test('mapper ignores tags', function(assert) { this.parseStream.on('data', dataCallback); this.lineStream.push(manifest); + assert.strictEqual(dataCallback.callCount, 1); + assert.deepEqual(dataCallback.getCall(0).args[0], { + text: 'TAG', + type: 'comment', + raw: undefined + }); +}); + +QUnit.test('mapper ignores tags and returns raw', function(assert) { + const manifest = '#TAG\n'; + const dataCallback = sinon.spy(); + + this.parseStreamReturnRaw.addTagMapper({ + expression: /^#NO-MATCH/, + map(line) { + return '#MAPPED'; + } + }); + + this.parseStreamReturnRaw.on('data', dataCallback); + this.lineStreamReturnRaw.push(manifest); + assert.strictEqual(dataCallback.callCount, 1); assert.deepEqual(dataCallback.getCall(0).args[0], { text: 'TAG', @@ -759,7 +908,7 @@ QUnit.test('parses valid #EXT-X-KEY tags', function(assert) { METHOD: 'AES-128', URI: 'https://priv.example.com/key.php?r=52' }, - raw: '#EXT-X-KEY:METHOD=AES-128,URI=\"https://priv.example.com/key.php?r=52\"' + raw: undefined }, 'parsed a valid key'); manifest = '#EXT-X-KEY:URI="https://example.com/key#1",METHOD=FutureType-1024\n'; @@ -772,7 +921,7 @@ QUnit.test('parses valid #EXT-X-KEY tags', function(assert) { METHOD: 'FutureType-1024', URI: 'https://example.com/key#1' }, - raw: '#EXT-X-KEY:URI=\"https://example.com/key#1\",METHOD=FutureType-1024' + raw: undefined }, 'parsed the attribute list independent of order'); manifest = '#EXT-X-KEY:IV=1234567890abcdef1234567890abcdef\n'; @@ -786,6 +935,52 @@ QUnit.test('parses valid #EXT-X-KEY tags', function(assert) { ]), 'parsed an IV value'); }); +// #EXT-X-KEY +QUnit.test('parses valid #EXT-X-KEY tags and returns raw', function(assert) { + let manifest = + '#EXT-X-KEY:METHOD=AES-128,URI="https://priv.example.com/key.php?r=52"\n'; + let element; + + this.parseStreamReturnRaw.on('data', function(elem) { + element = elem; + }); + this.lineStreamReturnRaw.push(manifest); + + assert.ok(element, 'an event was triggered'); + assert.deepEqual(element, { + type: 'tag', + tagType: 'key', + attributes: { + METHOD: 'AES-128', + URI: 'https://priv.example.com/key.php?r=52' + }, + raw: '#EXT-X-KEY:METHOD=AES-128,URI=\"https://priv.example.com/key.php?r=52\"' + }, 'parsed a valid key'); + + manifest = '#EXT-X-KEY:URI="https://example.com/key#1",METHOD=FutureType-1024\n'; + this.lineStreamReturnRaw.push(manifest); + assert.ok(element, 'an event was triggered'); + assert.deepEqual(element, { + type: 'tag', + tagType: 'key', + attributes: { + METHOD: 'FutureType-1024', + URI: 'https://example.com/key#1' + }, + raw: '#EXT-X-KEY:URI=\"https://example.com/key#1\",METHOD=FutureType-1024' + }, 'parsed the attribute list independent of order'); + + manifest = '#EXT-X-KEY:IV=1234567890abcdef1234567890abcdef\n'; + this.lineStreamReturnRaw.push(manifest); + assert.ok(element.attributes.IV, 'detected an IV attribute'); + assert.deepEqual(element.attributes.IV, new Uint32Array([ + 0x12345678, + 0x90abcdef, + 0x12345678, + 0x90abcdef + ]), 'parsed an IV value'); +}); + QUnit.test('parses minimal #EXT-X-KEY tags', function(assert) { const manifest = '#EXT-X-KEY:\n'; let element; @@ -795,6 +990,23 @@ QUnit.test('parses minimal #EXT-X-KEY tags', function(assert) { }); this.lineStream.push(manifest); + assert.ok(element, 'an event was triggered'); + assert.deepEqual(element, { + type: 'tag', + tagType: 'key', + raw: undefined + }, 'parsed a minimal key tag'); +}); + +QUnit.test('parses minimal #EXT-X-KEY tags and returns raw', function(assert) { + const manifest = '#EXT-X-KEY:\n'; + let element; + + this.parseStreamReturnRaw.on('data', function(elem) { + element = elem; + }); + this.lineStreamReturnRaw.push(manifest); + assert.ok(element, 'an event was triggered'); assert.deepEqual(element, { type: 'tag', diff --git a/test/parser.test.js b/test/parser.test.js index ab73ed0..9d33795 100644 --- a/test/parser.test.js +++ b/test/parser.test.js @@ -1,11 +1,14 @@ import QUnit from 'qunit'; import testDataExpected from 'data-files!expecteds'; import testDataManifests from 'data-files!manifests'; +import testDataExpectedWithRaw from 'data-files!expectedsWithRaw'; +import testDataManifestsWithRaw from 'data-files!manifestsWithRaw'; import {Parser} from '../src'; QUnit.module('m3u8s', function(hooks) { hooks.beforeEach(function() { this.parser = new Parser(); + this.parserReturnRaw = new Parser(true); QUnit.dump.maxDepth = 8; }); @@ -881,4 +884,26 @@ QUnit.module('m3u8s', function(hooks) { }); } + for (const key in testDataExpectedWithRaw) { + if (!testDataManifestsWithRaw[key]) { + throw new Error(`${key}.js does not have an equivelent m3u8 manifest to test against`); + } + } + + for (const key in testDataManifestsWithRaw) { + if (!testDataExpectedWithRaw[key]) { + throw new Error(`${key}.m3u8 does not have an equivelent expected js file to test against`); + } + QUnit.test(`parses ${key}.m3u8 as expected in ${key}.js`, function(assert) { + this.parserReturnRaw.push(testDataManifestsWithRaw[key]()); + this.parserReturnRaw.end(); + + assert.deepEqual( + this.parserReturnRaw.manifest, + testDataExpectedWithRaw[key](), + key + '.m3u8 was parsed correctly' + ); + }); + } + });