Skip to content

Commit

Permalink
Issues/add test for multiple rendition groups (kuu#138)
Browse files Browse the repository at this point in the history
* Add test for multipe rendition groups

* Add test for multipe rendition groups
  • Loading branch information
kuu authored Oct 21, 2023
1 parent bb4f8e0 commit 7383e95
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/spec/misc/multiple-rendition-groups.js
Original file line number Diff line number Diff line change
@@ -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));
});

0 comments on commit 7383e95

Please sign in to comment.