fix(native-adapter): resolve duplicate audio track labels for Audio Description tracks (SUP-52840)#883
Open
MosheMaorKaltura wants to merge 1 commit into
Open
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Tests
Jira
https://kaltura.atlassian.net/browse/SUP-52840