@amazon/vinyl-hls-parser 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/hlsTestAssets/types/current/tsconfig.tsbuildinfo +1 -1
  2. package/dist/index.cjs +140 -58
  3. package/dist/index.cjs.map +4 -4
  4. package/dist/index.js +139 -57
  5. package/dist/index.js.map +4 -4
  6. package/dist/test/benchmark.es5.js +79 -255
  7. package/dist/test/benchmark.js +584 -1224
  8. package/dist/test/benchmark.js.map +4 -4
  9. package/dist/types/current/index.d.ts +11 -10
  10. package/dist/types/current/index.d.ts.map +1 -1
  11. package/dist/types/current/index.js +11 -10
  12. package/dist/types/current/parse/parseMainPlaylist.d.ts +8 -3
  13. package/dist/types/current/parse/parseMainPlaylist.d.ts.map +1 -1
  14. package/dist/types/current/parse/parseMainPlaylist.js +43 -5
  15. package/dist/types/current/parse/parseMediaPlaylist.d.ts +11 -4
  16. package/dist/types/current/parse/parseMediaPlaylist.d.ts.map +1 -1
  17. package/dist/types/current/parse/parseMediaPlaylist.js +111 -7
  18. package/dist/types/current/tsconfig.tsbuildinfo +1 -1
  19. package/dist/types/current/types/AlternativeRendition.d.ts +13 -0
  20. package/dist/types/current/types/AlternativeRendition.d.ts.map +1 -1
  21. package/dist/types/current/types/HlsDateRange.d.ts +51 -0
  22. package/dist/types/current/types/HlsDateRange.d.ts.map +1 -0
  23. package/dist/types/current/types/HlsDateRange.js +11 -0
  24. package/dist/types/{ts4.7/types/MainPlaylist.d.ts → current/types/HlsMainPlaylist.d.ts} +4 -4
  25. package/dist/types/current/types/HlsMainPlaylist.d.ts.map +1 -0
  26. package/dist/types/{ts4.1/types/MediaPlaylist.d.ts → current/types/HlsMediaPlaylist.d.ts} +11 -4
  27. package/dist/types/current/types/HlsMediaPlaylist.d.ts.map +1 -0
  28. package/dist/types/ts3.7/index.d.ts +11 -10
  29. package/dist/types/ts3.7/parse/parseMainPlaylist.d.ts +8 -3
  30. package/dist/types/ts3.7/parse/parseMediaPlaylist.d.ts +11 -4
  31. package/dist/types/ts3.7/types/AlternativeRendition.d.ts +13 -0
  32. package/dist/types/ts3.7/types/HlsDateRange.d.ts +51 -0
  33. package/dist/types/ts3.7/types/{MainPlaylist.d.ts → HlsMainPlaylist.d.ts} +4 -4
  34. package/dist/types/ts3.7/types/{MediaPlaylist.d.ts → HlsMediaPlaylist.d.ts} +11 -4
  35. package/dist/types/ts4.1/index.d.ts +11 -10
  36. package/dist/types/ts4.1/parse/parseMainPlaylist.d.ts +8 -3
  37. package/dist/types/ts4.1/parse/parseMediaPlaylist.d.ts +11 -4
  38. package/dist/types/ts4.1/types/AlternativeRendition.d.ts +13 -0
  39. package/dist/types/ts4.1/types/HlsDateRange.d.ts +51 -0
  40. package/dist/types/{current/types/MainPlaylist.d.ts → ts4.1/types/HlsMainPlaylist.d.ts} +4 -4
  41. package/dist/types/{current/types/MediaPlaylist.d.ts → ts4.1/types/HlsMediaPlaylist.d.ts} +11 -4
  42. package/dist/types/ts4.7/index.d.ts +11 -10
  43. package/dist/types/ts4.7/parse/parseMainPlaylist.d.ts +8 -3
  44. package/dist/types/ts4.7/parse/parseMediaPlaylist.d.ts +11 -4
  45. package/dist/types/ts4.7/types/AlternativeRendition.d.ts +13 -0
  46. package/dist/types/ts4.7/types/HlsDateRange.d.ts +51 -0
  47. package/dist/types/{ts4.1/types/MainPlaylist.d.ts → ts4.7/types/HlsMainPlaylist.d.ts} +4 -4
  48. package/dist/types/ts4.7/types/{MediaPlaylist.d.ts → HlsMediaPlaylist.d.ts} +11 -4
  49. package/package.json +30 -19
  50. package/dist/test/benchmark.css +0 -71
  51. package/dist/test/benchmark.html +0 -67
  52. package/dist/test/favicon.png +0 -0
  53. package/dist/test/index.html +0 -61
  54. package/dist/test/integ.es5.js +0 -410
  55. package/dist/test/integ.js +0 -2127
  56. package/dist/test/integ.js.map +0 -7
  57. package/dist/test/jasmine.css +0 -304
  58. package/dist/test/jasmineHtml.es5.js +0 -670
  59. package/dist/test/jasmineHtml.js +0 -10851
  60. package/dist/test/jasmineHtml.js.map +0 -7
  61. package/dist/test/styles.css +0 -42
  62. package/dist/types/current/types/MainPlaylist.d.ts.map +0 -1
  63. package/dist/types/current/types/MediaPlaylist.d.ts.map +0 -1
  64. package/dist/unit/types/current/index.d.ts +0 -7
  65. package/dist/unit/types/current/index.d.ts.map +0 -1
  66. package/dist/unit/types/current/index.js +0 -6
  67. package/dist/unit/types/current/parse/parseAttributes.test.d.ts +0 -2
  68. package/dist/unit/types/current/parse/parseAttributes.test.d.ts.map +0 -1
  69. package/dist/unit/types/current/parse/parseAttributes.test.js +0 -70
  70. package/dist/unit/types/current/parse/parseMainPlaylist.test.d.ts +0 -2
  71. package/dist/unit/types/current/parse/parseMainPlaylist.test.d.ts.map +0 -1
  72. package/dist/unit/types/current/parse/parseMainPlaylist.test.js +0 -194
  73. package/dist/unit/types/current/parse/parseMediaPlaylist.test.d.ts +0 -2
  74. package/dist/unit/types/current/parse/parseMediaPlaylist.test.d.ts.map +0 -1
  75. package/dist/unit/types/current/parse/parseMediaPlaylist.test.js +0 -401
  76. package/dist/unit/types/current/parse/parseUtil.test.d.ts +0 -2
  77. package/dist/unit/types/current/parse/parseUtil.test.d.ts.map +0 -1
  78. package/dist/unit/types/current/parse/parseUtil.test.js +0 -67
  79. package/dist/unit/types/current/setup.d.ts +0 -2
  80. package/dist/unit/types/current/setup.d.ts.map +0 -1
  81. package/dist/unit/types/current/setup.js +0 -19
  82. package/dist/unit/types/current/tsconfig.tsbuildinfo +0 -1
  83. /package/dist/types/current/types/{MainPlaylist.js → HlsMainPlaylist.js} +0 -0
  84. /package/dist/types/current/types/{MediaPlaylist.js → HlsMediaPlaylist.js} +0 -0
@@ -1,42 +0,0 @@
1
- /*
2
- * Copyright (c) 2024. Amazon.com, Inc. or its affiliates. All rights reserved.
3
- */
4
-
5
- html,
6
- body {
7
- height: 100%;
8
- font-family: sans-serif;
9
- margin: 0;
10
- padding: 0;
11
- }
12
-
13
- body {
14
- background-color: #dcdee5;
15
- display: flex;
16
- flex-direction: column;
17
- }
18
-
19
- .callout {
20
- background-color: #bfcbdb;
21
- box-sizing: border-box;
22
- padding: 10px;
23
- font-family: Helvetica, Arial, 'sans-serif';
24
- cursor: pointer;
25
- transition: background-color 0.3s;
26
- }
27
-
28
- .callout:hover {
29
- background-color: #7d9fcc;
30
- }
31
-
32
- .instructions {
33
- display: inline-block;
34
- font-style: italic;
35
- padding: 5px;
36
- font-family: inherit;
37
- }
38
-
39
- .jasmine_html-reporter {
40
- margin: 0 !important;
41
- padding: 0 !important;
42
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"MainPlaylist.d.ts","sourceRoot":"","sources":["../../../../src/types/MainPlaylist.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAA;IAE3C,4FAA4F;IAC5F,QAAQ,CAAC,qBAAqB,EAAE,SAAS,oBAAoB,EAAE,CAAA;IAE/D,6DAA6D;IAC7D,QAAQ,CAAC,WAAW,EAAE,SAAS,WAAW,EAAE,CAAA;IAE5C,qGAAqG;IACrG,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACtD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MediaPlaylist.d.ts","sourceRoot":"","sources":["../../../../src/types/MediaPlaylist.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB,yGAAyG;IACzG,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAE/B,uFAAuF;IACvF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAE9B,wGAAwG;IACxG,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAA;IAExC,oFAAoF;IACpF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IAEvB,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAA;CAC3C;AAED,6CAA6C;AAC7C,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA"}
@@ -1,7 +0,0 @@
1
- /** Auto-generated from build scripts */
2
- import './setup';
3
- import './parse/parseUtil.test';
4
- import './parse/parseMediaPlaylist.test';
5
- import './parse/parseMainPlaylist.test';
6
- import './parse/parseAttributes.test';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../test/unit/index.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,SAAS,CAAA;AAChB,OAAO,wBAAwB,CAAA;AAC/B,OAAO,iCAAiC,CAAA;AACxC,OAAO,gCAAgC,CAAA;AACvC,OAAO,8BAA8B,CAAA"}
@@ -1,6 +0,0 @@
1
- /** Auto-generated from build scripts */
2
- import './setup';
3
- import './parse/parseUtil.test';
4
- import './parse/parseMediaPlaylist.test';
5
- import './parse/parseMainPlaylist.test';
6
- import './parse/parseAttributes.test';
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=parseAttributes.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseAttributes.test.d.ts","sourceRoot":"","sources":["../../../../../test/unit/parse/parseAttributes.test.ts"],"names":[],"mappings":""}
@@ -1,70 +0,0 @@
1
- /*
2
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { StringReader } from '@amazon/vinyl-util';
6
- import { parseAttributes } from '@amazon/vinyl-hls-parser';
7
- describe('parseAttributes', () => {
8
- it('parses simple key-value pairs', () => {
9
- const reader = new StringReader('BANDWIDTH=1280000,CODECS="avc1.42e00a"');
10
- const attrs = parseAttributes(reader);
11
- expect(attrs['BANDWIDTH']).toBe('1280000');
12
- expect(attrs['CODECS']).toBe('avc1.42e00a');
13
- });
14
- it('handles quoted values with embedded commas', () => {
15
- const reader = new StringReader('CODECS="avc1.42e00a,mp4a.40.2",BANDWIDTH=1280000');
16
- const attrs = parseAttributes(reader);
17
- expect(attrs['CODECS']).toBe('avc1.42e00a,mp4a.40.2');
18
- expect(attrs['BANDWIDTH']).toBe('1280000');
19
- });
20
- it('handles a single unquoted attribute', () => {
21
- const reader = new StringReader('BANDWIDTH=1280000');
22
- const attrs = parseAttributes(reader);
23
- expect(attrs['BANDWIDTH']).toBe('1280000');
24
- });
25
- it('handles a single quoted attribute', () => {
26
- const reader = new StringReader('URI="segment.ts"');
27
- const attrs = parseAttributes(reader);
28
- expect(attrs['URI']).toBe('segment.ts');
29
- });
30
- it('returns empty record for empty input', () => {
31
- const reader = new StringReader('');
32
- const attrs = parseAttributes(reader);
33
- expect(Object.keys(attrs).length).toBe(0);
34
- });
35
- it('handles multiple quoted values', () => {
36
- const reader = new StringReader('TYPE=AUDIO,GROUP-ID="audio",NAME="English",LANGUAGE="en"');
37
- const attrs = parseAttributes(reader);
38
- expect(attrs['TYPE']).toBe('AUDIO');
39
- expect(attrs['GROUP-ID']).toBe('audio');
40
- expect(attrs['NAME']).toBe('English');
41
- expect(attrs['LANGUAGE']).toBe('en');
42
- });
43
- it('skips empty key', () => {
44
- const reader = new StringReader('=value,KEY=test');
45
- const attrs = parseAttributes(reader);
46
- expect(Object.keys(attrs).length).toBe(0);
47
- });
48
- it('handles missing equals sign', () => {
49
- const reader = new StringReader('NOEQUALS');
50
- const attrs = parseAttributes(reader);
51
- expect(Object.keys(attrs).length).toBe(0);
52
- });
53
- it('handles quoted value without closing quote', () => {
54
- const reader = new StringReader('KEY="unclosed');
55
- const attrs = parseAttributes(reader);
56
- expect(attrs['KEY']).toBe('unclosed');
57
- });
58
- it('stops at newline', () => {
59
- const reader = new StringReader('KEY=value\nIGNORED=ignored');
60
- const attrs = parseAttributes(reader);
61
- expect(attrs['KEY']).toBe('value');
62
- expect(attrs['IGNORED']).toBeUndefined();
63
- });
64
- it('stops at carriage return', () => {
65
- const reader = new StringReader('KEY=value\rIGNORED=ignored');
66
- const attrs = parseAttributes(reader);
67
- expect(attrs['KEY']).toBe('value');
68
- expect(attrs['IGNORED']).toBeUndefined();
69
- });
70
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=parseMainPlaylist.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseMainPlaylist.test.d.ts","sourceRoot":"","sources":["../../../../../test/unit/parse/parseMainPlaylist.test.ts"],"names":[],"mappings":""}
@@ -1,194 +0,0 @@
1
- /*
2
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { StringParseError, ValidationError } from '@amazon/vinyl-util';
6
- import { parseMainPlaylist } from '@amazon/vinyl-hls-parser';
7
- describe('parseMainPlaylist', () => {
8
- it('throws StringParseError when #EXTM3U is missing', () => {
9
- expect(() => parseMainPlaylist('invalid')).toThrowError(StringParseError);
10
- });
11
- it('parses variant streams with bandwidth and uri', () => {
12
- const manifest = [
13
- '#EXTM3U',
14
- '#EXT-X-STREAM-INF:BANDWIDTH=1280000',
15
- 'low/index.m3u8',
16
- '#EXT-X-STREAM-INF:BANDWIDTH=2560000',
17
- 'mid/index.m3u8',
18
- ].join('\n');
19
- const result = parseMainPlaylist(manifest);
20
- expect(result.variants.length).toBe(2);
21
- expect(result.variants[0].bandwidth).toBe(1280000);
22
- expect(result.variants[0].uri).toBe('low/index.m3u8');
23
- expect(result.variants[1].bandwidth).toBe(2560000);
24
- expect(result.variants[1].uri).toBe('mid/index.m3u8');
25
- });
26
- it('parses variant streams with optional attributes', () => {
27
- const manifest = [
28
- '#EXTM3U',
29
- '#EXT-X-STREAM-INF:BANDWIDTH=1280000,CODECS="avc1.42e00a,mp4a.40.2",RESOLUTION=640x360,FRAME-RATE=29.97,AUDIO="audio-group",VIDEO="video-group",SUBTITLES="subs"',
30
- 'variant.m3u8',
31
- ].join('\n');
32
- const result = parseMainPlaylist(manifest);
33
- const v = result.variants[0];
34
- expect(v.bandwidth).toBe(1280000);
35
- expect(v.codecs).toBe('avc1.42e00a,mp4a.40.2');
36
- expect(v.width).toBe(640);
37
- expect(v.height).toBe(360);
38
- expect(v.frameRate).toBe(29.97);
39
- expect(v.audioGroup).toBe('audio-group');
40
- expect(v.videoGroup).toBe('video-group');
41
- expect(v.subtitlesGroup).toBe('subs');
42
- });
43
- it('parses alternative renditions', () => {
44
- const manifest = [
45
- '#EXTM3U',
46
- '#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="English",LANGUAGE="en",DEFAULT=YES,AUTOSELECT=YES,URI="audio/en.m3u8"',
47
- '#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="Spanish",LANGUAGE="es",DEFAULT=NO,AUTOSELECT=NO',
48
- ].join('\n');
49
- const result = parseMainPlaylist(manifest);
50
- expect(result.alternativeRenditions.length).toBe(2);
51
- const en = result.alternativeRenditions[0];
52
- expect(en.type).toBe('AUDIO');
53
- expect(en.groupId).toBe('audio');
54
- expect(en.name).toBe('English');
55
- expect(en.language).toBe('en');
56
- expect(en.default).toBe(true);
57
- expect(en.autoSelect).toBe(true);
58
- expect(en.uri).toBe('audio/en.m3u8');
59
- const es = result.alternativeRenditions[1];
60
- expect(es.default).toBe(false);
61
- expect(es.autoSelect).toBe(false);
62
- expect(es.uri).toBeUndefined();
63
- });
64
- it('parses session data', () => {
65
- const manifest = [
66
- '#EXTM3U',
67
- '#EXT-X-SESSION-DATA:DATA-ID="com.example.title",VALUE="Episode 1",LANGUAGE="en"',
68
- '#EXT-X-SESSION-DATA:DATA-ID="com.example.poster",URI="/poster.jpg"',
69
- ].join('\n');
70
- const result = parseMainPlaylist(manifest);
71
- expect(result.sessionData.length).toBe(2);
72
- expect(result.sessionData[0].dataId).toBe('com.example.title');
73
- expect(result.sessionData[0].value).toBe('Episode 1');
74
- expect(result.sessionData[0].language).toBe('en');
75
- expect(result.sessionData[0].uri).toBeUndefined();
76
- expect(result.sessionData[1].dataId).toBe('com.example.poster');
77
- expect(result.sessionData[1].uri).toBe('/poster.jpg');
78
- expect(result.sessionData[1].value).toBeUndefined();
79
- });
80
- it('skips blank lines and comments', () => {
81
- const manifest = [
82
- '#EXTM3U',
83
- '',
84
- '# This is a comment',
85
- '#EXT-X-STREAM-INF:BANDWIDTH=1280000',
86
- '',
87
- 'low/index.m3u8',
88
- ].join('\n');
89
- const result = parseMainPlaylist(manifest);
90
- expect(result.variants.length).toBe(1);
91
- expect(result.variants[0].uri).toBe('low/index.m3u8');
92
- });
93
- it('handles lines with only whitespace', () => {
94
- const manifest = [
95
- '#EXTM3U',
96
- ' ',
97
- '\t\t',
98
- '#EXT-X-STREAM-INF:BANDWIDTH=1280000',
99
- ' \t ',
100
- 'low/index.m3u8',
101
- ].join('\n');
102
- const result = parseMainPlaylist(manifest);
103
- expect(result.variants.length).toBe(1);
104
- expect(result.variants[0].uri).toBe('low/index.m3u8');
105
- });
106
- it('handles empty manifest after header', () => {
107
- const manifest = '#EXTM3U\n';
108
- const result = parseMainPlaylist(manifest);
109
- expect(result.variants.length).toBe(0);
110
- expect(result.alternativeRenditions.length).toBe(0);
111
- expect(result.sessionData.length).toBe(0);
112
- });
113
- it('handles line with only whitespace in main playlist', () => {
114
- const manifest = `#EXTM3U
115
-
116
- #EXT-X-STREAM-INF:BANDWIDTH=1280000
117
- low/index.m3u8`;
118
- const result = parseMainPlaylist(manifest);
119
- expect(result.variants.length).toBe(1);
120
- });
121
- it('handles line that becomes empty after trimming', () => {
122
- // Create a line with non-breaking space that might not be caught by skipWhitespaceLine
123
- const manifest = '#EXTM3U\n\u00A0\n#EXT-X-STREAM-INF:BANDWIDTH=1280000\nlow/index.m3u8';
124
- const result = parseMainPlaylist(manifest);
125
- expect(result.variants.length).toBe(1);
126
- });
127
- it('skips unrecognized tags', () => {
128
- const manifest = [
129
- '#EXTM3U',
130
- '#EXT-X-INDEPENDENT-SEGMENTS',
131
- '#EXT-X-STREAM-INF:BANDWIDTH=1280000',
132
- 'low/index.m3u8',
133
- ].join('\n');
134
- const result = parseMainPlaylist(manifest);
135
- expect(result.variants.length).toBe(1);
136
- });
137
- it('tolerates leading whitespace before #EXTM3U', () => {
138
- const manifest = ' \n#EXTM3U\n#EXT-X-STREAM-INF:BANDWIDTH=1280000\nlow/index.m3u8';
139
- const result = parseMainPlaylist(manifest);
140
- expect(result.variants.length).toBe(1);
141
- });
142
- it('returns empty arrays when no variants, renditions, or session data', () => {
143
- const result = parseMainPlaylist('#EXTM3U\n');
144
- expect(result.variants.length).toBe(0);
145
- expect(result.alternativeRenditions.length).toBe(0);
146
- expect(result.sessionData.length).toBe(0);
147
- });
148
- it('handles invalid resolution format', () => {
149
- const manifest = [
150
- '#EXTM3U',
151
- '#EXT-X-STREAM-INF:BANDWIDTH=1280000,RESOLUTION=640',
152
- 'variant.m3u8',
153
- ].join('\n');
154
- expect(() => parseMainPlaylist(manifest)).toThrowError(ValidationError);
155
- });
156
- it('handles invalid resolution values', () => {
157
- const manifest = [
158
- '#EXTM3U',
159
- '#EXT-X-STREAM-INF:BANDWIDTH=1280000,RESOLUTION=0x360',
160
- 'variant.m3u8',
161
- ].join('\n');
162
- expect(() => parseMainPlaylist(manifest)).toThrowError(ValidationError);
163
- });
164
- it('parses valid resolution correctly', () => {
165
- const manifest = [
166
- '#EXTM3U',
167
- '#EXT-X-STREAM-INF:BANDWIDTH=1280000,RESOLUTION=1920x1080',
168
- 'variant.m3u8',
169
- ].join('\n');
170
- const result = parseMainPlaylist(manifest);
171
- expect(result.variants[0].width).toBe(1920);
172
- expect(result.variants[0].height).toBe(1080);
173
- });
174
- it('parses #EXT-X-DEFINE variables', () => {
175
- const manifest = [
176
- '#EXTM3U',
177
- '#EXT-X-DEFINE:NAME="baseUrl",VALUE="https://cdn.example.com/"',
178
- '#EXT-X-STREAM-INF:BANDWIDTH=500000',
179
- 'low.m3u8',
180
- ].join('\n');
181
- const result = parseMainPlaylist(manifest);
182
- expect(result.defines).toEqual({ baseUrl: 'https://cdn.example.com/' });
183
- });
184
- it('ignores #EXT-X-DEFINE without VALUE', () => {
185
- const manifest = [
186
- '#EXTM3U',
187
- '#EXT-X-DEFINE:NAME="incomplete"',
188
- '#EXT-X-STREAM-INF:BANDWIDTH=500000',
189
- 'low.m3u8',
190
- ].join('\n');
191
- const result = parseMainPlaylist(manifest);
192
- expect(result.defines).toEqual({});
193
- });
194
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=parseMediaPlaylist.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseMediaPlaylist.test.d.ts","sourceRoot":"","sources":["../../../../../test/unit/parse/parseMediaPlaylist.test.ts"],"names":[],"mappings":""}