@transmitlive/m3u8-parser 4.7.2-beta.6
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.
- package/CONTRIBUTING.md +30 -0
- package/LICENSE +13 -0
- package/README.md +388 -0
- package/dist/m3u8-parser.cjs.js +1563 -0
- package/dist/m3u8-parser.es.js +1549 -0
- package/dist/m3u8-parser.js +1748 -0
- package/dist/m3u8-parser.min.js +2 -0
- package/index.html +15 -0
- package/package.json +100 -0
- package/scripts/karma.conf.js +12 -0
- package/scripts/rollup.config.js +47 -0
- package/src/index.js +19 -0
- package/src/line-stream.js +35 -0
- package/src/parse-stream.js +619 -0
- package/src/parser.js +748 -0
- package/test/fixtures/integration/absoluteUris.js +31 -0
- package/test/fixtures/integration/absoluteUris.m3u8 +12 -0
- package/test/fixtures/integration/allowCache.js +165 -0
- package/test/fixtures/integration/allowCache.m3u8 +58 -0
- package/test/fixtures/integration/allowCacheInvalid.js +21 -0
- package/test/fixtures/integration/allowCacheInvalid.m3u8 +10 -0
- package/test/fixtures/integration/alternateAudio.js +56 -0
- package/test/fixtures/integration/alternateAudio.m3u8 +9 -0
- package/test/fixtures/integration/alternateVideo.js +48 -0
- package/test/fixtures/integration/alternateVideo.m3u8 +8 -0
- package/test/fixtures/integration/brightcove.js +57 -0
- package/test/fixtures/integration/brightcove.m3u8 +9 -0
- package/test/fixtures/integration/byteRange.js +161 -0
- package/test/fixtures/integration/byteRange.m3u8 +56 -0
- package/test/fixtures/integration/dateTime.js +27 -0
- package/test/fixtures/integration/dateTime.m3u8 +12 -0
- package/test/fixtures/integration/diff-init-key.js +164 -0
- package/test/fixtures/integration/diff-init-key.m3u8 +57 -0
- package/test/fixtures/integration/disallowCache.js +21 -0
- package/test/fixtures/integration/disallowCache.m3u8 +10 -0
- package/test/fixtures/integration/disc-sequence.js +32 -0
- package/test/fixtures/integration/disc-sequence.m3u8 +15 -0
- package/test/fixtures/integration/discontinuity.js +59 -0
- package/test/fixtures/integration/discontinuity.m3u8 +26 -0
- package/test/fixtures/integration/domainUris.js +31 -0
- package/test/fixtures/integration/domainUris.m3u8 +12 -0
- package/test/fixtures/integration/empty.js +5 -0
- package/test/fixtures/integration/empty.m3u8 +0 -0
- package/test/fixtures/integration/emptyAllowCache.js +21 -0
- package/test/fixtures/integration/emptyAllowCache.m3u8 +10 -0
- package/test/fixtures/integration/emptyMediaSequence.js +31 -0
- package/test/fixtures/integration/emptyMediaSequence.m3u8 +14 -0
- package/test/fixtures/integration/emptyPlaylistType.js +40 -0
- package/test/fixtures/integration/emptyPlaylistType.m3u8 +16 -0
- package/test/fixtures/integration/emptyTargetDuration.js +57 -0
- package/test/fixtures/integration/emptyTargetDuration.m3u8 +10 -0
- package/test/fixtures/integration/encrypted.js +61 -0
- package/test/fixtures/integration/encrypted.m3u8 +28 -0
- package/test/fixtures/integration/event.js +41 -0
- package/test/fixtures/integration/event.m3u8 +16 -0
- package/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.js +15 -0
- package/test/fixtures/integration/extXPlaylistTypeInvalidPlaylist.m3u8 +8 -0
- package/test/fixtures/integration/extinf.js +165 -0
- package/test/fixtures/integration/extinf.m3u8 +57 -0
- package/test/fixtures/integration/fmp4.js +44 -0
- package/test/fixtures/integration/fmp4.m3u8 +14 -0
- package/test/fixtures/integration/headerOnly.js +5 -0
- package/test/fixtures/integration/headerOnly.m3u8 +1 -0
- package/test/fixtures/integration/invalidAllowCache.js +21 -0
- package/test/fixtures/integration/invalidAllowCache.m3u8 +10 -0
- package/test/fixtures/integration/invalidMediaSequence.js +31 -0
- package/test/fixtures/integration/invalidMediaSequence.m3u8 +14 -0
- package/test/fixtures/integration/invalidPlaylistType.js +40 -0
- package/test/fixtures/integration/invalidPlaylistType.m3u8 +16 -0
- package/test/fixtures/integration/invalidTargetDuration.js +164 -0
- package/test/fixtures/integration/invalidTargetDuration.m3u8 +57 -0
- package/test/fixtures/integration/liveMissingSegmentDuration.js +25 -0
- package/test/fixtures/integration/liveMissingSegmentDuration.m3u8 +9 -0
- package/test/fixtures/integration/liveStart30sBefore.js +54 -0
- package/test/fixtures/integration/liveStart30sBefore.m3u8 +22 -0
- package/test/fixtures/integration/llhls-byte-range.js +253 -0
- package/test/fixtures/integration/llhls-byte-range.m3u8 +66 -0
- package/test/fixtures/integration/llhls-delta-byte-range.js +149 -0
- package/test/fixtures/integration/llhls-delta-byte-range.m3u8 +30 -0
- package/test/fixtures/integration/llhls.js +214 -0
- package/test/fixtures/integration/llhls.m3u8 +56 -0
- package/test/fixtures/integration/llhlsDelta.js +186 -0
- package/test/fixtures/integration/llhlsDelta.m3u8 +50 -0
- package/test/fixtures/integration/manifestExtTTargetdurationNegative.js +14 -0
- package/test/fixtures/integration/manifestExtTTargetdurationNegative.m3u8 +5 -0
- package/test/fixtures/integration/manifestExtXEndlistEarly.js +35 -0
- package/test/fixtures/integration/manifestExtXEndlistEarly.m3u8 +14 -0
- package/test/fixtures/integration/manifestNoExtM3u.js +15 -0
- package/test/fixtures/integration/manifestNoExtM3u.m3u8 +4 -0
- package/test/fixtures/integration/master-fmp4.js +465 -0
- package/test/fixtures/integration/master-fmp4.m3u8 +76 -0
- package/test/fixtures/integration/master.js +57 -0
- package/test/fixtures/integration/master.m3u8 +10 -0
- package/test/fixtures/integration/media.js +31 -0
- package/test/fixtures/integration/media.m3u8 +12 -0
- package/test/fixtures/integration/mediaSequence.js +31 -0
- package/test/fixtures/integration/mediaSequence.m3u8 +14 -0
- package/test/fixtures/integration/missingEndlist.js +19 -0
- package/test/fixtures/integration/missingEndlist.m3u8 +6 -0
- package/test/fixtures/integration/missingExtinf.js +27 -0
- package/test/fixtures/integration/missingExtinf.m3u8 +11 -0
- package/test/fixtures/integration/missingMediaSequence.js +31 -0
- package/test/fixtures/integration/missingMediaSequence.m3u8 +13 -0
- package/test/fixtures/integration/missingSegmentDuration.js +31 -0
- package/test/fixtures/integration/missingSegmentDuration.m3u8 +11 -0
- package/test/fixtures/integration/multipleAudioGroups.js +89 -0
- package/test/fixtures/integration/multipleAudioGroups.m3u8 +17 -0
- package/test/fixtures/integration/multipleAudioGroupsCombinedMain.js +88 -0
- package/test/fixtures/integration/multipleAudioGroupsCombinedMain.m3u8 +17 -0
- package/test/fixtures/integration/multipleTargetDurations.js +28 -0
- package/test/fixtures/integration/multipleTargetDurations.m3u8 +8 -0
- package/test/fixtures/integration/multipleVideo.js +74 -0
- package/test/fixtures/integration/multipleVideo.m3u8 +16 -0
- package/test/fixtures/integration/negativeMediaSequence.js +31 -0
- package/test/fixtures/integration/negativeMediaSequence.m3u8 +14 -0
- package/test/fixtures/integration/playlist.js +165 -0
- package/test/fixtures/integration/playlist.m3u8 +57 -0
- package/test/fixtures/integration/playlistMediaSequenceHigher.js +16 -0
- package/test/fixtures/integration/playlistMediaSequenceHigher.m3u8 +8 -0
- package/test/fixtures/integration/start.js +36 -0
- package/test/fixtures/integration/start.m3u8 +13 -0
- package/test/fixtures/integration/streamInfInvalid.js +24 -0
- package/test/fixtures/integration/streamInfInvalid.m3u8 +6 -0
- package/test/fixtures/integration/twoMediaSequences.js +31 -0
- package/test/fixtures/integration/twoMediaSequences.m3u8 +15 -0
- package/test/fixtures/integration/versionInvalid.js +16 -0
- package/test/fixtures/integration/versionInvalid.m3u8 +8 -0
- package/test/fixtures/integration/whiteSpace.js +31 -0
- package/test/fixtures/integration/whiteSpace.m3u8 +13 -0
- package/test/fixtures/integration/zeroDuration.js +16 -0
- package/test/fixtures/integration/zeroDuration.m3u8 +7 -0
- package/test/line-stream.test.js +80 -0
- package/test/parse-stream.test.js +903 -0
- package/test/parser.test.js +884 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
allowCache: true,
|
|
3
|
+
mediaSequence: 0,
|
|
4
|
+
playlistType: 'VOD',
|
|
5
|
+
segments: [
|
|
6
|
+
{
|
|
7
|
+
byterange: {
|
|
8
|
+
length: 522828,
|
|
9
|
+
offset: 0
|
|
10
|
+
},
|
|
11
|
+
duration: 10,
|
|
12
|
+
timeline: 0,
|
|
13
|
+
uri: 'hls_450k_video.ts'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
byterange: {
|
|
17
|
+
length: 587500,
|
|
18
|
+
offset: 522828
|
|
19
|
+
},
|
|
20
|
+
duration: 10,
|
|
21
|
+
timeline: 0,
|
|
22
|
+
uri: 'hls_450k_video.ts'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
byterange: {
|
|
26
|
+
length: 713084,
|
|
27
|
+
offset: 1110328
|
|
28
|
+
},
|
|
29
|
+
duration: 10,
|
|
30
|
+
timeline: 0,
|
|
31
|
+
uri: 'hls_450k_video.ts'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
byterange: {
|
|
35
|
+
length: 476580,
|
|
36
|
+
offset: 1823412
|
|
37
|
+
},
|
|
38
|
+
duration: 10,
|
|
39
|
+
timeline: 0,
|
|
40
|
+
uri: 'hls_450k_video.ts'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
byterange: {
|
|
44
|
+
length: 535612,
|
|
45
|
+
offset: 2299992
|
|
46
|
+
},
|
|
47
|
+
duration: 10,
|
|
48
|
+
timeline: 0,
|
|
49
|
+
uri: 'hls_450k_video.ts'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
byterange: {
|
|
53
|
+
length: 207176,
|
|
54
|
+
offset: 2835604
|
|
55
|
+
},
|
|
56
|
+
duration: 10,
|
|
57
|
+
timeline: 0,
|
|
58
|
+
uri: 'hls_450k_video.ts'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
byterange: {
|
|
62
|
+
length: 455900,
|
|
63
|
+
offset: 3042780
|
|
64
|
+
},
|
|
65
|
+
duration: 10,
|
|
66
|
+
timeline: 0,
|
|
67
|
+
uri: 'hls_450k_video.ts'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
byterange: {
|
|
71
|
+
length: 657248,
|
|
72
|
+
offset: 3498680
|
|
73
|
+
},
|
|
74
|
+
duration: 10,
|
|
75
|
+
timeline: 0,
|
|
76
|
+
uri: 'hls_450k_video.ts'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
byterange: {
|
|
80
|
+
length: 571708,
|
|
81
|
+
offset: 4155928
|
|
82
|
+
},
|
|
83
|
+
duration: 10,
|
|
84
|
+
timeline: 0,
|
|
85
|
+
uri: 'hls_450k_video.ts'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
byterange: {
|
|
89
|
+
length: 485040,
|
|
90
|
+
offset: 4727636
|
|
91
|
+
},
|
|
92
|
+
duration: 10,
|
|
93
|
+
timeline: 0,
|
|
94
|
+
uri: 'hls_450k_video.ts'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
byterange: {
|
|
98
|
+
length: 709136,
|
|
99
|
+
offset: 5212676
|
|
100
|
+
},
|
|
101
|
+
duration: 10,
|
|
102
|
+
timeline: 0,
|
|
103
|
+
uri: 'hls_450k_video.ts'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
byterange: {
|
|
107
|
+
length: 730004,
|
|
108
|
+
offset: 5921812
|
|
109
|
+
},
|
|
110
|
+
duration: 10,
|
|
111
|
+
timeline: 0,
|
|
112
|
+
uri: 'hls_450k_video.ts'
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
byterange: {
|
|
116
|
+
length: 456276,
|
|
117
|
+
offset: 6651816
|
|
118
|
+
},
|
|
119
|
+
duration: 10,
|
|
120
|
+
timeline: 0,
|
|
121
|
+
uri: 'hls_450k_video.ts'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
byterange: {
|
|
125
|
+
length: 468684,
|
|
126
|
+
offset: 7108092
|
|
127
|
+
},
|
|
128
|
+
duration: 10,
|
|
129
|
+
timeline: 0,
|
|
130
|
+
uri: 'hls_450k_video.ts'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
byterange: {
|
|
134
|
+
length: 444996,
|
|
135
|
+
offset: 7576776
|
|
136
|
+
},
|
|
137
|
+
duration: 10,
|
|
138
|
+
timeline: 0,
|
|
139
|
+
uri: 'hls_450k_video.ts'
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
byterange: {
|
|
143
|
+
length: 331444,
|
|
144
|
+
offset: 8021772
|
|
145
|
+
},
|
|
146
|
+
duration: 10,
|
|
147
|
+
timeline: 0,
|
|
148
|
+
uri: 'hls_450k_video.ts'
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
byterange: {
|
|
152
|
+
length: 44556,
|
|
153
|
+
offset: 8353216
|
|
154
|
+
},
|
|
155
|
+
duration: 1.4167,
|
|
156
|
+
timeline: 0,
|
|
157
|
+
uri: 'hls_450k_video.ts'
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
targetDuration: 10,
|
|
161
|
+
endList: true,
|
|
162
|
+
discontinuitySequence: 0,
|
|
163
|
+
discontinuityStarts: [],
|
|
164
|
+
version: 4
|
|
165
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#EXTM3U
|
|
2
|
+
#EXT-X-TARGETDURATION:10
|
|
3
|
+
#EXT-X-VERSION:4
|
|
4
|
+
#EXT-X-MEDIA-SEQUENCE:0
|
|
5
|
+
#EXT-X-PLAYLIST-TYPE:VOD
|
|
6
|
+
#EXTINF:10,
|
|
7
|
+
#EXT-X-BYTERANGE:522828@0
|
|
8
|
+
hls_450k_video.ts
|
|
9
|
+
#EXTINF:10,
|
|
10
|
+
#EXT-X-BYTERANGE:587500@522828
|
|
11
|
+
hls_450k_video.ts
|
|
12
|
+
#EXTINF:10,
|
|
13
|
+
#EXT-X-BYTERANGE:713084@1110328
|
|
14
|
+
hls_450k_video.ts
|
|
15
|
+
#EXTINF:10,
|
|
16
|
+
#EXT-X-BYTERANGE:476580@1823412
|
|
17
|
+
hls_450k_video.ts
|
|
18
|
+
#EXTINF:10,
|
|
19
|
+
#EXT-X-BYTERANGE:535612@2299992
|
|
20
|
+
hls_450k_video.ts
|
|
21
|
+
#EXTINF:10,
|
|
22
|
+
#EXT-X-BYTERANGE:207176@2835604
|
|
23
|
+
hls_450k_video.ts
|
|
24
|
+
#EXTINF:10,
|
|
25
|
+
#EXT-X-BYTERANGE:455900@3042780
|
|
26
|
+
hls_450k_video.ts
|
|
27
|
+
#EXTINF:10,
|
|
28
|
+
#EXT-X-BYTERANGE:657248@3498680
|
|
29
|
+
hls_450k_video.ts
|
|
30
|
+
#EXTINF:10,
|
|
31
|
+
#EXT-X-BYTERANGE:571708@4155928
|
|
32
|
+
hls_450k_video.ts
|
|
33
|
+
#EXTINF:10,
|
|
34
|
+
#EXT-X-BYTERANGE:485040@4727636
|
|
35
|
+
hls_450k_video.ts
|
|
36
|
+
#EXTINF:10,
|
|
37
|
+
#EXT-X-BYTERANGE:709136@5212676
|
|
38
|
+
hls_450k_video.ts
|
|
39
|
+
#EXTINF:10,
|
|
40
|
+
#EXT-X-BYTERANGE:730004@5921812
|
|
41
|
+
hls_450k_video.ts
|
|
42
|
+
#EXTINF:10,
|
|
43
|
+
#EXT-X-BYTERANGE:456276@6651816
|
|
44
|
+
hls_450k_video.ts
|
|
45
|
+
#EXTINF:10,
|
|
46
|
+
#EXT-X-BYTERANGE:468684@7108092
|
|
47
|
+
hls_450k_video.ts
|
|
48
|
+
#EXTINF:10,
|
|
49
|
+
#EXT-X-BYTERANGE:444996@7576776
|
|
50
|
+
hls_450k_video.ts
|
|
51
|
+
#EXTINF:10,
|
|
52
|
+
#EXT-X-BYTERANGE:331444@8021772
|
|
53
|
+
hls_450k_video.ts
|
|
54
|
+
#EXTINF:1.4167,
|
|
55
|
+
#EXT-X-BYTERANGE:44556@8353216
|
|
56
|
+
hls_450k_video.ts
|
|
57
|
+
#EXT-X-ENDLIST
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
allowCache: true,
|
|
3
|
+
mediaSequence: 17,
|
|
4
|
+
playlistType: 'VOD',
|
|
5
|
+
segments: [
|
|
6
|
+
{
|
|
7
|
+
duration: 6.64,
|
|
8
|
+
timeline: 0,
|
|
9
|
+
uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts'
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
targetDuration: 8,
|
|
13
|
+
endList: true,
|
|
14
|
+
discontinuitySequence: 0,
|
|
15
|
+
discontinuityStarts: []
|
|
16
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
allowCache: true,
|
|
3
|
+
mediaSequence: 0,
|
|
4
|
+
playlistType: 'VOD',
|
|
5
|
+
segments: [
|
|
6
|
+
{
|
|
7
|
+
duration: 10,
|
|
8
|
+
timeline: 0,
|
|
9
|
+
uri: 'media-00001.ts'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
duration: 10,
|
|
13
|
+
timeline: 0,
|
|
14
|
+
uri: 'media-00002.ts'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
duration: 10,
|
|
18
|
+
timeline: 0,
|
|
19
|
+
uri: 'media-00003.ts'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
duration: 10,
|
|
23
|
+
timeline: 0,
|
|
24
|
+
uri: 'media-00004.ts'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
targetDuration: 10,
|
|
28
|
+
endList: true,
|
|
29
|
+
discontinuitySequence: 0,
|
|
30
|
+
discontinuityStarts: [],
|
|
31
|
+
start: {
|
|
32
|
+
timeOffset: 10.3,
|
|
33
|
+
precise: false
|
|
34
|
+
},
|
|
35
|
+
version: 3
|
|
36
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
allowCache: true,
|
|
3
|
+
playlists: [
|
|
4
|
+
{
|
|
5
|
+
attributes: {
|
|
6
|
+
'PROGRAM-ID': 1
|
|
7
|
+
},
|
|
8
|
+
timeline: 0,
|
|
9
|
+
uri: 'media.m3u8'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
timeline: 0,
|
|
13
|
+
uri: 'media1.m3u8'
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
discontinuityStarts: [],
|
|
17
|
+
mediaGroups: {
|
|
18
|
+
'VIDEO': {},
|
|
19
|
+
'AUDIO': {},
|
|
20
|
+
'CLOSED-CAPTIONS': {},
|
|
21
|
+
'SUBTITLES': {}
|
|
22
|
+
},
|
|
23
|
+
segments: []
|
|
24
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
allowCache: true,
|
|
3
|
+
mediaSequence: 11,
|
|
4
|
+
playlistType: 'VOD',
|
|
5
|
+
segments: [
|
|
6
|
+
{
|
|
7
|
+
duration: 6.64,
|
|
8
|
+
timeline: 0,
|
|
9
|
+
uri: '/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
duration: 6.08,
|
|
13
|
+
timeline: 0,
|
|
14
|
+
uri: '/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
duration: 6.6,
|
|
18
|
+
timeline: 0,
|
|
19
|
+
uri: '/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
duration: 5,
|
|
23
|
+
timeline: 0,
|
|
24
|
+
uri: '/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
targetDuration: 8,
|
|
28
|
+
endList: true,
|
|
29
|
+
discontinuitySequence: 0,
|
|
30
|
+
discontinuityStarts: []
|
|
31
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#EXTM3U
|
|
2
|
+
#EXT-X-PLAYLIST-TYPE:VOD
|
|
3
|
+
#EXT-X-MEDIA-SEQUENCE:0
|
|
4
|
+
#EXT-X-MEDIA-SEQUENCE:11
|
|
5
|
+
#EXT-X-ALLOW-CACHE:YES
|
|
6
|
+
#EXT-X-TARGETDURATION:8
|
|
7
|
+
#EXTINF:6.640,{}
|
|
8
|
+
/test/ts-files/tvy7/8a5e2822668b5370f4eb1438b2564fb7ab12ffe1-hi720.ts
|
|
9
|
+
#EXTINF:6.080,{}
|
|
10
|
+
/test/ts-files/tvy7/56be1cef869a1c0cc8e38864ad1add17d187f051-hi720.ts
|
|
11
|
+
#EXTINF:6.600,{}
|
|
12
|
+
/test/ts-files/tvy7/549c8c77f55f049741a06596e5c1e01dacaa46d0-hi720.ts
|
|
13
|
+
#EXTINF:5.000,{}
|
|
14
|
+
/test/ts-files/tvy7/6cfa378684ffeb1c455a64dae6c103290a1f53d4-hi720.ts
|
|
15
|
+
#EXT-X-ENDLIST
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
allowCache: true,
|
|
3
|
+
mediaSequence: 0,
|
|
4
|
+
playlistType: 'VOD',
|
|
5
|
+
segments: [
|
|
6
|
+
{
|
|
7
|
+
duration: 10,
|
|
8
|
+
timeline: 0,
|
|
9
|
+
uri: 'hls_450k_video.ts'
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
targetDuration: 10,
|
|
13
|
+
endList: true,
|
|
14
|
+
discontinuitySequence: 0,
|
|
15
|
+
discontinuityStarts: []
|
|
16
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
allowCache: true,
|
|
3
|
+
mediaSequence: 0,
|
|
4
|
+
playlistType: 'VOD',
|
|
5
|
+
segments: [
|
|
6
|
+
{
|
|
7
|
+
duration: 10,
|
|
8
|
+
timeline: 0,
|
|
9
|
+
uri: 'http://example.com/00001.ts'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
duration: 10,
|
|
13
|
+
timeline: 0,
|
|
14
|
+
uri: 'https://example.com/00002.ts'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
duration: 10,
|
|
18
|
+
timeline: 0,
|
|
19
|
+
uri: '//example.com/00003.ts'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
duration: 10,
|
|
23
|
+
timeline: 0,
|
|
24
|
+
uri: 'http://example.com/00004.ts'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
targetDuration: 10,
|
|
28
|
+
endList: true,
|
|
29
|
+
discontinuitySequence: 0,
|
|
30
|
+
discontinuityStarts: []
|
|
31
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#EXTM3U
|
|
2
|
+
#EXT-X-PLAYLIST-TYPE:VOD
|
|
3
|
+
#EXT-X-TARGETDURATION:10
|
|
4
|
+
|
|
5
|
+
#EXTINF:10,
|
|
6
|
+
http://example.com/00001.ts
|
|
7
|
+
#EXTINF:10,
|
|
8
|
+
https://example.com/00002.ts
|
|
9
|
+
#EXTINF:10,
|
|
10
|
+
//example.com/00003.ts
|
|
11
|
+
#EXTINF:10,
|
|
12
|
+
http://example.com/00004.ts
|
|
13
|
+
#EXT-X-ENDLIST
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
allowCache: true,
|
|
3
|
+
mediaSequence: 0,
|
|
4
|
+
playlistType: 'VOD',
|
|
5
|
+
segments: [
|
|
6
|
+
{
|
|
7
|
+
duration: 0.01,
|
|
8
|
+
timeline: 0,
|
|
9
|
+
uri: 'http://example.com/00001.ts'
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
targetDuration: 10,
|
|
13
|
+
endList: true,
|
|
14
|
+
discontinuitySequence: 0,
|
|
15
|
+
discontinuityStarts: []
|
|
16
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {LineStream} from '../src';
|
|
2
|
+
import QUnit from 'qunit';
|
|
3
|
+
|
|
4
|
+
QUnit.module('LineStream', {
|
|
5
|
+
beforeEach() {
|
|
6
|
+
this.lineStream = new LineStream();
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
QUnit.test('empty inputs produce no tokens', function(assert) {
|
|
10
|
+
let data = false;
|
|
11
|
+
|
|
12
|
+
this.lineStream.on('data', function() {
|
|
13
|
+
data = true;
|
|
14
|
+
});
|
|
15
|
+
this.lineStream.push('');
|
|
16
|
+
assert.ok(!data, 'no tokens were produced');
|
|
17
|
+
});
|
|
18
|
+
QUnit.test('splits on newlines', function(assert) {
|
|
19
|
+
const lines = [];
|
|
20
|
+
|
|
21
|
+
this.lineStream.on('data', function(line) {
|
|
22
|
+
lines.push(line);
|
|
23
|
+
});
|
|
24
|
+
this.lineStream.push('#EXTM3U\nmovie.ts\n');
|
|
25
|
+
|
|
26
|
+
assert.strictEqual(2, lines.length, 'two lines are ready');
|
|
27
|
+
assert.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token');
|
|
28
|
+
assert.strictEqual('movie.ts', lines.shift(), 'the second line is the second token');
|
|
29
|
+
});
|
|
30
|
+
QUnit.test('empty lines become empty strings', function(assert) {
|
|
31
|
+
const lines = [];
|
|
32
|
+
|
|
33
|
+
this.lineStream.on('data', function(line) {
|
|
34
|
+
lines.push(line);
|
|
35
|
+
});
|
|
36
|
+
this.lineStream.push('\n\n');
|
|
37
|
+
|
|
38
|
+
assert.strictEqual(2, lines.length, 'two lines are ready');
|
|
39
|
+
assert.strictEqual('', lines.shift(), 'the first line is empty');
|
|
40
|
+
assert.strictEqual('', lines.shift(), 'the second line is empty');
|
|
41
|
+
});
|
|
42
|
+
QUnit.test('handles lines broken across appends', function(assert) {
|
|
43
|
+
const lines = [];
|
|
44
|
+
|
|
45
|
+
this.lineStream.on('data', function(line) {
|
|
46
|
+
lines.push(line);
|
|
47
|
+
});
|
|
48
|
+
this.lineStream.push('#EXTM');
|
|
49
|
+
assert.strictEqual(0, lines.length, 'no lines are ready');
|
|
50
|
+
|
|
51
|
+
this.lineStream.push('3U\nmovie.ts\n');
|
|
52
|
+
assert.strictEqual(2, lines.length, 'two lines are ready');
|
|
53
|
+
assert.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token');
|
|
54
|
+
assert.strictEqual('movie.ts', lines.shift(), 'the second line is the second token');
|
|
55
|
+
});
|
|
56
|
+
QUnit.test('stops sending events after deregistering', function(assert) {
|
|
57
|
+
const temporaryLines = [];
|
|
58
|
+
const temporary = function(line) {
|
|
59
|
+
temporaryLines.push(line);
|
|
60
|
+
};
|
|
61
|
+
const permanentLines = [];
|
|
62
|
+
const permanent = function(line) {
|
|
63
|
+
permanentLines.push(line);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
this.lineStream.on('data', temporary);
|
|
67
|
+
this.lineStream.on('data', permanent);
|
|
68
|
+
this.lineStream.push('line one\n');
|
|
69
|
+
assert.strictEqual(
|
|
70
|
+
temporaryLines.length,
|
|
71
|
+
permanentLines.length,
|
|
72
|
+
'both callbacks receive the event'
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
assert.ok(this.lineStream.off('data', temporary), 'a listener was removed');
|
|
76
|
+
this.lineStream.push('line two\n');
|
|
77
|
+
assert.strictEqual(1, temporaryLines.length, 'no new events are received');
|
|
78
|
+
assert.strictEqual(2, permanentLines.length, 'new events are still received');
|
|
79
|
+
});
|
|
80
|
+
|