Skip to content

Commit

Permalink
feat(UI): Separate trackLabelFormat settings for text tracks and audi…
Browse files Browse the repository at this point in the history
…o tracks (#6052)

Closes #6008
  • Loading branch information
avelad committed Jan 9, 2024
1 parent c189922 commit a94a602
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions ui/externs/ui.js
Expand Up @@ -87,6 +87,7 @@ shaka.extern.UIVolumeBarColors;
* seekBarColors: shaka.extern.UISeekBarColors,
* volumeBarColors: shaka.extern.UIVolumeBarColors,
* trackLabelFormat: shaka.ui.Overlay.TrackLabelFormat,
* textTrackLabelFormat: shaka.ui.Overlay.TrackLabelFormat,
* fadeDelay: number,
* doubleClickForFullscreen: boolean,
* singleClickForPlayAndPause: boolean,
Expand Down Expand Up @@ -156,8 +157,18 @@ shaka.extern.UIVolumeBarColors;
* colors used in the linear gradient constructed in JavaScript, since you
* cannot do this in pure CSS.
* @property {shaka.ui.Overlay.TrackLabelFormat} trackLabelFormat
* An enum that determines what is shown in the labels for text track and
* audio variant selection.
* An enum that determines what is shown in the labels for audio variant
* selection.
* LANGUAGE means that only the language of the item is shown.
* ROLE means that only the role of the item is shown.
* LANGUAGE_ROLE means both language and role are shown, or just language if
* there is no role.
* LABEL means the non-standard DASH "label" attribute or the standard DASH
* "Label" element or the HLS "NAME" attribute are shown.
* Defaults to LANGUAGE.
* @property {shaka.ui.Overlay.TrackLabelFormat} textTrackLabelFormat
* An enum that determines what is shown in the labels for text track
* selection.
* LANGUAGE means that only the language of the item is shown.
* ROLE means that only the role of the item is shown.
* LANGUAGE_ROLE means both language and role are shown, or just language if
Expand Down
2 changes: 1 addition & 1 deletion ui/text_selection.js
Expand Up @@ -135,7 +135,7 @@ shaka.ui.TextSelection = class extends shaka.ui.SettingsMenu {
this.player.isTextTrackVisible(),
this.currentSelection,
this.localization,
this.controls.getConfig().trackLabelFormat,
this.controls.getConfig().textTrackLabelFormat,
this.controls.getConfig().showAudioChannelCountVariants);

// Add the Off button
Expand Down
1 change: 1 addition & 0 deletions ui/ui.js
Expand Up @@ -237,6 +237,7 @@ shaka.ui.Overlay = class {
level: 'rgb(255, 255, 255)',
},
trackLabelFormat: shaka.ui.Overlay.TrackLabelFormat.LANGUAGE,
textTrackLabelFormat: shaka.ui.Overlay.TrackLabelFormat.LANGUAGE,
fadeDelay: 0,
doubleClickForFullscreen: true,
singleClickForPlayAndPause: true,
Expand Down

0 comments on commit a94a602

Please sign in to comment.