From 7383e95118211d768cf7737b295ccc99adc0c11a Mon Sep 17 00:00:00 2001 From: Kuu Miyazaki Date: Fri, 20 Oct 2023 19:00:00 -0700 Subject: [PATCH] Issues/add test for multiple rendition groups (#138) * Add test for multipe rendition groups * Add test for multipe rendition groups --- test/spec/misc/multiple-rendition-groups.js | 49 +++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/spec/misc/multiple-rendition-groups.js diff --git a/test/spec/misc/multiple-rendition-groups.js b/test/spec/misc/multiple-rendition-groups.js new file mode 100644 index 0000000..89e4b85 --- /dev/null +++ b/test/spec/misc/multiple-rendition-groups.js @@ -0,0 +1,49 @@ +const test = require("ava"); +const utils = require("../../helpers/utils"); +const HLS = require("../../.."); + +test("Multiple-Rendition-Groups_01", t => { + const shouldRead = ` + #EXTM3U + #EXT-X-VERSION:4 + #EXT-X-INDEPENDENT-SEGMENTS + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_high",NAME="English",DEFAULT=YES,URI="aac_high_eng.m3u8" + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_high",NAME="Japanese",DEFAULT=NO,URI="aac_high_jp.m3u8" + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_mid",NAME="English",DEFAULT=YES,URI="aac_mid_eng.m3u8" + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_mid",NAME="Japanese",DEFAULT=NO,URI="aac_mid_jp.m3u8" + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_low",NAME="English",DEFAULT=YES,URI="aac_low_eng.m3u8" + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_low",NAME="Japanese",DEFAULT=NO,URI="aac_low_jp.m3u8" + #EXT-X-STREAM-INF:BANDWIDTH=6000000,AUDIO="aac_high" + 1080p.m3u8 + #EXT-X-STREAM-INF:BANDWIDTH=3000000,AUDIO="aac_mid" + 720p.m3u8 + #EXT-X-STREAM-INF:BANDWIDTH=1500000,AUDIO="aac_mid" + 540p.m3u8 + #EXT-X-STREAM-INF:BANDWIDTH=1000000,AUDIO="aac_low" + 360p.m3u8 + `; + + const playlist = HLS.parse(shouldRead); + + const shouldWrite = ` + #EXTM3U + #EXT-X-VERSION:4 + #EXT-X-INDEPENDENT-SEGMENTS + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_high",NAME="English",DEFAULT=YES,URI="aac_high_eng.m3u8" + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_high",NAME="Japanese",DEFAULT=NO,URI="aac_high_jp.m3u8" + #EXT-X-STREAM-INF:BANDWIDTH=6000000,AUDIO="aac_high" + 1080p.m3u8 + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_mid",NAME="English",DEFAULT=YES,URI="aac_mid_eng.m3u8" + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_mid",NAME="Japanese",DEFAULT=NO,URI="aac_mid_jp.m3u8" + #EXT-X-STREAM-INF:BANDWIDTH=3000000,AUDIO="aac_mid" + 720p.m3u8 + #EXT-X-STREAM-INF:BANDWIDTH=1500000,AUDIO="aac_mid" + 540p.m3u8 + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_low",NAME="English",DEFAULT=YES,URI="aac_low_eng.m3u8" + #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac_low",NAME="Japanese",DEFAULT=NO,URI="aac_low_jp.m3u8" + #EXT-X-STREAM-INF:BANDWIDTH=1000000,AUDIO="aac_low" + 360p.m3u8 + `; + + t.is(HLS.stringify(playlist), utils.stripCommentsAndEmptyLines(shouldWrite)); +});