Skip to content

Commit

Permalink
Fix an issue that causes an exception when calling extendedFilter wit…
Browse files Browse the repository at this point in the history
…h an empty string (#4085)
  • Loading branch information
dsilhavy authored Nov 10, 2022
1 parent b764801 commit 7b6197f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/streaming/controllers/MediaController.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ function MediaController() {

if (settings) {
tracks = Array.from(tracksForType);

tracks = filterTracksBySettings(tracks, matchSettingsLang, settings);
tracks = filterTracksBySettings(tracks, matchSettingsIndex, settings);
tracks = filterTracksBySettings(tracks, matchSettingsViewPoint, settings);
if ( !(type === Constants.AUDIO && !!lastSelectedTracks[type]) ) {
if (!(type === Constants.AUDIO && !!lastSelectedTracks[type])) {
tracks = filterTracksBySettings(tracks, matchSettingsRole, settings);
}
tracks = filterTracksBySettings(tracks, matchSettingsAccessibility, settings);
Expand Down Expand Up @@ -330,9 +330,9 @@ function MediaController() {

function matchSettingsLang(settings, track) {
return !settings.lang ||
(settings.lang instanceof RegExp)?
(track.lang.match(settings.lang)):
(extendedFilter(track.lang, bcp47Normalize(settings.lang)).length>0);
(settings.lang instanceof RegExp) ?
(track.lang.match(settings.lang)) : track.lang !== '' ?
(extendedFilter(track.lang, bcp47Normalize(settings.lang)).length > 0) : false;
}

function matchSettingsIndex(settings, track) {
Expand All @@ -358,7 +358,7 @@ function MediaController() {
// match only those tracks having no accessibility element present
matchAccessibility = !track.accessibility.length;
} else {
matchAccessibility = !!track.accessibility.filter(function (item) {
matchAccessibility = !!track.accessibility.filter(function (item) {
return item === settings.accessibility;
})[0];
}
Expand All @@ -371,7 +371,7 @@ function MediaController() {
return item === settings.audioChannelConfiguration;
})[0];

return matchAudioChannelConfiguration;
return matchAudioChannelConfiguration;
}

function matchSettings(settings, track, isTrackActive = false) {
Expand Down

0 comments on commit 7b6197f

Please sign in to comment.