File tree Expand file tree Collapse file tree 3 files changed +30
-11
lines changed
test/parser/__snapshots__ Expand file tree Collapse file tree 3 files changed +30
-11
lines changed Original file line number Diff line number Diff line change 66 "dev" : " bun --watch --inspect=ws://localhost:6500/sprs-stitcher ./src/index.ts" ,
77 "dev:wrangler" : " wrangler dev ./src/index.ts" ,
88 "build" : " bun build ./src/index.ts --target=bun --outdir=./dist" ,
9- "deploy:wrangler" : " wrangler deploy --minify ./src/index.ts" ,
9+ "deploy:wrangler" : " npx wrangler deploy --minify ./src/index.ts" ,
1010 "test" : " bun test" ,
1111 "lint" : " tsc && eslint"
1212 },
Original file line number Diff line number Diff line change @@ -211,6 +211,8 @@ function parseLine(line: string): Tag | null {
211211 name : attrs . name ,
212212 uri : attrs . uri ,
213213 channels : attrs . channels ,
214+ default : attrs . default ,
215+ autoSelect : attrs . autoSelect ,
214216 } ,
215217 ] ;
216218 }
@@ -301,6 +303,18 @@ function parseLine(line: string): Tag | null {
301303 case "EXT-X-CUE-OUT" : {
302304 assert ( param , "EXT-X-CUE-OUT: no param" ) ;
303305
306+ // EXT-X-CUE-OUT can also contain only a number. Try to parse it,
307+ // and assume its the duration.
308+ const valueAsNumber = Number . parseFloat ( param ) ;
309+ if ( ! Number . isNaN ( valueAsNumber ) ) {
310+ return [
311+ name ,
312+ {
313+ duration : valueAsNumber ,
314+ } ,
315+ ] ;
316+ }
317+
304318 const attrs : Partial < CueOut > = { } ;
305319
306320 mapAttributes ( param , ( key , value ) => {
@@ -329,12 +343,17 @@ function parseLine(line: string): Tag | null {
329343 mapAttributes ( param , ( key , value ) => {
330344 switch ( key ) {
331345 case "METHOD" :
346+ attrs . method = value ;
347+ break ;
332348 case "URI" :
349+ attrs . uri = value ;
350+ break ;
333351 case "KEYFORMAT" :
352+ attrs . format = value ;
353+ break ;
334354 case "KEYFORMATVERSION" :
335- attrs . method = value ;
355+ attrs . formatVersion = value ;
336356 break ;
337-
338357 case "IV" :
339358 attrs . iv = parseIV ( value ) ;
340359 break ;
Original file line number Diff line number Diff line change @@ -36,29 +36,29 @@ exports[`parse master should parse with groups 1`] = `
3636 " independentSegments" : false ,
3737 " renditions" : [
3838 {
39- " autoSelect" : undefined ,
39+ " autoSelect" : true ,
4040 " channels" : undefined ,
41- " default" : undefined ,
41+ " default" : true ,
4242 " groupId" : " aud1" ,
4343 " language" : " eng" ,
4444 " name" : " English" ,
4545 " type" : " AUDIO" ,
4646 " uri" : " a1.m3u8" ,
4747 },
4848 {
49- " autoSelect" : undefined ,
49+ " autoSelect" : true ,
5050 " channels" : undefined ,
51- " default" : undefined ,
51+ " default" : true ,
5252 " groupId" : " aud2" ,
5353 " language" : " nld" ,
5454 " name" : " Nederlands" ,
5555 " type" : " AUDIO" ,
5656 " uri" : " a2.m3u8" ,
5757 },
5858 {
59- " autoSelect" : undefined ,
59+ " autoSelect" : true ,
6060 " channels" : undefined ,
61- " default" : undefined ,
61+ " default" : true ,
6262 " groupId" : " sub1" ,
6363 " language" : " eng" ,
6464 " name" : " English" ,
@@ -98,9 +98,9 @@ exports[`parse master should parse with audio channels 1`] = `
9898 " independentSegments" : false ,
9999 " renditions" : [
100100 {
101- " autoSelect" : undefined ,
101+ " autoSelect" : true ,
102102 " channels" : " 6" ,
103- " default" : undefined ,
103+ " default" : true ,
104104 " groupId" : " aud1" ,
105105 " language" : " eng" ,
106106 " name" : " English" ,
You can’t perform that action at this time.
0 commit comments