Skip to content

Commit

Permalink
fix: Fix select label audio when using selectAudioLanguage (#7970)
Browse files Browse the repository at this point in the history
Related to #7968
  • Loading branch information
avelad committed Jan 29, 2025
1 parent 3a91bf0 commit 24608ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -5296,10 +5296,11 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
* @param {number=} safeMargin
* @param {string=} codec
* @param {boolean=} spatialAudio
* @param {string=} label
* @export
*/
selectAudioLanguage(language, role, channelsCount = 0, safeMargin = 0,
codec = '', spatialAudio = false) {
codec = '', spatialAudio = false, label = '') {
const selectMediaSourceMode = () => {
this.currentAdaptationSetCriteria_ =
this.config_.adaptationSetCriteriaFactory();
Expand All @@ -5310,7 +5311,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
hdrLevel: '',
spatialAudio: spatialAudio || false,
videoLayout: '',
audioLabel: '',
audioLabel: label || '',
videoLabel: '',
codecSwitchingStrategy:
this.config_.mediaSource.codecSwitchingStrategy,
Expand Down
7 changes: 6 additions & 1 deletion ui/audio_language_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ shaka.ui.AudioLanguageSelection = class extends shaka.ui.SettingsMenu {
if (track.audioCodec) {
codec = track.audioCodec;
}
let label = '';
if (track.label) {
label = track.label;
}
this.player.selectAudioLanguage(track.language, track.roles[0],
channelsCount, /* safeMargin= */ 0, codec, track.spatialAudio);
channelsCount, /* safeMargin= */ 0, codec, track.spatialAudio,
label);
}


Expand Down

0 comments on commit 24608ff

Please sign in to comment.