Skip to content

Commit

Permalink
fix(hls): Fixes parsing of HLS 'DEFAULT' attribute (#3771)
Browse files Browse the repository at this point in the history
Closes #3769
  • Loading branch information
pcruiksh authored and joeyparrish committed Jan 5, 2022
1 parent 11d50f6 commit 7be62fa
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
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,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
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,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 @@ -794,6 +794,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 @@ -803,6 +804,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 7be62fa

Please sign in to comment.