Skip to content

Commit

Permalink
Add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish committed Dec 7, 2022
1 parent 73839c8 commit cca43ca
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions test/hls/hls_parser_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,86 @@ describe('HlsParser', () => {
await testHlsParser(master, media, manifest);
});

// https://github.com/shaka-project/shaka-player/issues/4759
it('makes roles available without loading tracks', async () => {
const master = [
'#EXTM3U\n',
'#EXT-X-STREAM-INF:BANDWIDTH=200,CODECS="avc1",',
'RESOLUTION=960x540,FRAME-RATE=60,AUDIO="aud1",SUBTITLES="sub1"\n',
'video\n',

'#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud1",LANGUAGE="en",',
'NAME="English",URI="audio"\n',

'#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud1",LANGUAGE="en",',
'CHARACTERISTICS="public.accessibility.describes-video,',
'public.accessibility.describes-music-and-sound",',
'NAME="English (describes-video)",URI="audio2"\n',

'#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="sub1",LANGUAGE="en",',
'NAME="English (caption)",DEFAULT=YES,AUTOSELECT=YES,',
'URI="text"\n',

'#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="sub1",LANGUAGE="en",',
'NAME="English (caption)",DEFAULT=YES,AUTOSELECT=YES,',
'CHARACTERISTICS="public.accessibility.describes-spoken-dialog,',
'public.accessibility.describes-music-and-sound",',
'URI="text2"\n',
].join('');

const media = [
'#EXTM3U\n',
'#EXT-X-PLAYLIST-TYPE:VOD\n',
'#EXT-X-MAP:URI="init.mp4",BYTERANGE="616@0"\n',
'#EXTINF:5,\n',
'#EXT-X-BYTERANGE:121090@616\n',
'main.mp4',
].join('');

const manifest = shaka.test.ManifestGenerator.generate((manifest) => {
manifest.anyTimeline();
manifest.addPartialVariant((variant) => {
variant.language = 'en';
variant.addPartialStream(ContentType.VIDEO);
variant.addPartialStream(ContentType.AUDIO, (stream) => {
stream.language = 'en';
});
});
manifest.addPartialVariant((variant) => {
variant.language = 'en';
variant.addPartialStream(ContentType.VIDEO);
variant.addPartialStream(ContentType.AUDIO, (stream) => {
stream.language = 'en';
stream.roles = [
'public.accessibility.describes-video',
'public.accessibility.describes-music-and-sound',
];
});
});
manifest.addPartialTextStream((stream) => {
stream.language = 'en';
stream.kind = TextStreamKind.SUBTITLE;
});
manifest.addPartialTextStream((stream) => {
stream.language = 'en';
stream.kind = TextStreamKind.SUBTITLE;
stream.roles = [
'public.accessibility.describes-spoken-dialog',
'public.accessibility.describes-music-and-sound',
];
});
manifest.sequenceMode = true;
});

fakeNetEngine.setResponseText('test:/master', master);

// NOTE: Not using testHlsParser here because that unconditionally loads all
// streams. We need to test the behavior specifically when streams are
// _not_ loaded.
const actual = await parser.start('test:/master', playerInterface);
expect(actual).toEqual(manifest);
});

it('gets mime type from header request', async () => {
const master = [
'#EXTM3U\n',
Expand Down

0 comments on commit cca43ca

Please sign in to comment.