Skip to content

fix(hls-adapter): translate HLS audio track labels to native names (SUP-52289)#242

Open
MosheMaorKaltura wants to merge 1 commit into
masterfrom
fix/SUP-52289-hls-audio-track-labels-not-translated
Open

fix(hls-adapter): translate HLS audio track labels to native names (SUP-52289)#242
MosheMaorKaltura wants to merge 1 commit into
masterfrom
fix/SUP-52289-hls-audio-track-labels-not-translated

Conversation

@MosheMaorKaltura

Copy link
Copy Markdown
Contributor

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

  • src/hls-adapter.ts — import getNativeLanguageName, use in _parseAudioTracks

Companion PR

kaltura/playkit-js#878 — adds the getNativeLanguageName utility and fixes the native adapter

Jira

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

… 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>
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.

1 participant