Skip to content

fix(native-adapter): resolve duplicate audio track labels for Audio Description tracks (SUP-52840)#883

Open
MosheMaorKaltura wants to merge 1 commit into
masterfrom
fix/SUP-52840-duplicate-audio-description-labels
Open

fix(native-adapter): resolve duplicate audio track labels for Audio Description tracks (SUP-52840)#883
MosheMaorKaltura wants to merge 1 commit into
masterfrom
fix/SUP-52840-duplicate-audio-description-labels

Conversation

@MosheMaorKaltura

Copy link
Copy Markdown
Contributor

Problem

When an entry has both a standard English audio track and an English Audio Description track, the audio selector shows two identical "English" labels. Users cannot tell which track is which.

Root Cause

_getParsedAudioTracks() calls getNativeLanguageName(audioTracks[i].language, audioTracks[i].label) for every track. When two tracks share language code "en", Intl.DisplayNames returns "English" for both — discarding the raw browser label (e.g. "English - Audio Description") that the browser sourced from the HLS manifest NAME attribute.

Fix

Added _resolveDuplicateAudioLabels(parsedTracks, rawAudioTracks) private method called after the initial label-building loop.

It counts how many tracks share each translated label. For any track whose label is shared, it checks the corresponding raw HTMLMediaElement audioTracks[i].label (populated from the manifest NAME attribute). If the raw label is non-empty and differs from the translated name, it replaces the duplicate with the raw label.

Files Changed

  • src/engines/html5/media-source/adapters/native-adapter.ts (+33 lines)

Tests

  • Build: TypeScript + API Extractor completed successfully with no errors

Jira

https://kaltura.atlassian.net/browse/SUP-52840

…escription tracks (SUP-52840)

When two audio tracks share the same ISO language code (e.g. "en" for both
standard and Audio Description), Intl.DisplayNames returns identical labels
for both, causing the audio selector to show duplicate "English" entries.

Add _resolveDuplicateAudioLabels() which detects collisions after the initial
Intl-translated label pass, then falls back to the raw HTMLMediaElement label
(typically sourced from the HLS manifest NAME attribute, e.g.
"English - Audio Description") for any track whose translated label is shared.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants