fix(hls-adapter): translate HLS audio track labels to native names (SUP-52289)#242
Open
MosheMaorKaltura wants to merge 1 commit into
Open
fix(hls-adapter): translate HLS audio track labels to native names (SUP-52289)#242MosheMaorKaltura wants to merge 1 commit into
MosheMaorKaltura wants to merge 1 commit into
Conversation
… names (SUP-52289) HLS manifests use English NAME= attributes (e.g. "Spanish") while DASH manifests carry ISO codes that the DASH adapter resolves to native names (Español, Português, 日本語). On iOS Safari, which cannot use DASH and falls back to HLS, audio track labels were shown in English. Use the new getNativeLanguageName() exported by @playkit-js/playkit-js in _parseAudioTracks() to convert the ISO LANGUAGE= code (e.g. "es") to the native display name via Intl.DisplayNames, falling back to the manifest NAME= value when the language code is absent or the runtime does not support the API. Co-Authored-By: Claude Opus 4.7 <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
On iOS Safari (and desktop when hls.js is active), HLS audio track labels show English words ("Spanish", "Portuguese", "Japanese") instead of native language names ("Español", "Português", "日本語"). The DASH adapter shows native names because Shaka returns ISO codes and the DASH manifest uses native names; the HLS adapter uses the English NAME= attribute from the manifest verbatim.
Root Cause
_parseAudioTracks used hlsAudioTracks[i].name directly as the label. The HLS manifest NAME= attribute is English (e.g. NAME="Spanish"), while the LANGUAGE= attribute carries the ISO code (e.g. LANGUAGE="es"). The ISO code was set as language but the English name was shown to the user.
Fix
Import the new getNativeLanguageName() exported by @playkit-js/playkit-js and use it in _parseAudioTracks() to derive the label from the ISO language code (hlsAudioTracks[i].lang) via Intl.DisplayNames, falling back to the manifest NAME= value when the language code is absent or the API is unavailable.
This ensures parity with the DASH adapter: both now show native language names.
Files Changed
Companion PR
kaltura/playkit-js#878 — adds the getNativeLanguageName utility and fixes the native adapter
Jira
https://kaltura.atlassian.net/browse/SUP-52289