Skip to content

Commit

Permalink
fix(hls): Fixes parsing of HLS 'DEFAULT' attribute (shaka-project#3771)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcruiksh committed Dec 6, 2021
1 parent fb90679 commit 3e7a5b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/hls/hls_parser.js
Expand Up @@ -1207,7 +1207,7 @@ shaka.hls.HlsParser = class {
// "AUTOSELECT=YES". A value of "AUTOSELECT=NO" would imply that it may
// only be selected explicitly by the user, and we don't have a way to
// represent that in our model.
const defaultAttrValue = tag.getAttribute('DEFAULT');
const defaultAttrValue = tag.getAttributeValue('DEFAULT');
const primary = defaultAttrValue == 'YES';

const channelsCount = type == 'audio' ? this.getChannelsCount_(tag) : null;
Expand Down
4 changes: 3 additions & 1 deletion test/hls/hls_parser_unit.js
Expand Up @@ -785,7 +785,7 @@ describe('HlsParser', () => {
'RESOLUTION=960x540,FRAME-RATE=120,AUDIO="aud2"\n',
'video2\n',
'#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud1",LANGUAGE="eng",',
'URI="audio"\n',
'DEFAULT=YES,URI="audio"\n',
'#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aud2",LANGUAGE="fr",',
'URI="audio2"\n',
].join('');
Expand All @@ -803,6 +803,7 @@ describe('HlsParser', () => {
manifest.anyTimeline();
manifest.addPartialVariant((variant) => {
variant.bandwidth = 200;
variant.primary = true;
variant.addPartialStream(ContentType.VIDEO, (stream) => {
stream.size(960, 540);
});
Expand All @@ -812,6 +813,7 @@ describe('HlsParser', () => {
});
manifest.addPartialVariant((variant) => {
variant.bandwidth = 300;
variant.primary = false;
variant.addPartialStream(ContentType.VIDEO, (stream) => {
stream.size(960, 540);
});
Expand Down

0 comments on commit 3e7a5b5

Please sign in to comment.