@playkit-js/playkit-js-ui 0.83.13 → 0.83.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -52,6 +52,9 @@ const COMPONENT_NAME = 'AudioMenu';
|
|
|
52
52
|
|
|
53
53
|
const _AudioMenu = (props: AudioMenuProps) => {
|
|
54
54
|
const activeAudioLanguage = props.player ? getActiveAudioLanguage(props.player) : undefined;
|
|
55
|
+
// Use track id for active comparison when available — language-based matching breaks when
|
|
56
|
+
// two tracks share the same language code (e.g. English + English Audio Description).
|
|
57
|
+
const activeAudioTrackId = props.player ? props.player.getActiveTracks()?.audio?.id : undefined;
|
|
55
58
|
|
|
56
59
|
const audioOptions = useMemo(() => {
|
|
57
60
|
return props.audioTracks?.length
|
|
@@ -70,10 +73,15 @@ const _AudioMenu = (props: AudioMenuProps) => {
|
|
|
70
73
|
: props.thereIsNoAudioDescriptionAvailableText
|
|
71
74
|
}`;
|
|
72
75
|
|
|
76
|
+
// Prefer id-based comparison; fall back to language when ids are unavailable.
|
|
77
|
+
const isActive = activeAudioTrackId !== undefined
|
|
78
|
+
? t.id === activeAudioTrackId
|
|
79
|
+
: (t.language === activeAudioLanguage);
|
|
80
|
+
|
|
73
81
|
return {
|
|
74
82
|
label,
|
|
75
83
|
ariaLabel,
|
|
76
|
-
active:
|
|
84
|
+
active: isActive as boolean,
|
|
77
85
|
value: t
|
|
78
86
|
};
|
|
79
87
|
})
|
|
@@ -85,7 +93,8 @@ const _AudioMenu = (props: AudioMenuProps) => {
|
|
|
85
93
|
props.audioDescriptionAvailableText,
|
|
86
94
|
props.thereIsAudioDescriptionAvailableText,
|
|
87
95
|
props.thereIsNoAudioDescriptionAvailableText,
|
|
88
|
-
activeAudioLanguage
|
|
96
|
+
activeAudioLanguage,
|
|
97
|
+
activeAudioTrackId
|
|
89
98
|
]);
|
|
90
99
|
|
|
91
100
|
function onAudioChange(audioTrack: any): void {
|