fix(SUP-51711): Audio Description Language selection not working as expected in some browsers - #272
Merged
Merged
Conversation
roeedean
approved these changes
May 5, 2026
3 tasks
MosheMaorKaltura
added a commit
that referenced
this pull request
May 27, 2026
…to prevent duplicate tracks from HD flavors (#273) ## Summary - **SUP-51711 regression (FEC-14971)**: On entries with a single audio AdaptationSet containing multiple bitrate Representations, `getAudioTracks()` (introduced in PRs #271/#272) returns one entry per Representation — producing 2 identical-looking `und` tracks in the audio selector. - **Fix**: Deduplicate `getAudioTracks()` output by `language::label` key before returning. Tracks with the same user-visible properties (language + label) are collapsed to one; the active track wins. This preserves all distinct tracks (e.g. English + English AD) while collapsing bitrate-only duplicates. - **Null-safety**: `audioTrack.label ?? undefined` in `selectAudioLanguage()` prevents passing `null` where Shaka expects `string | undefined`. ## Root cause `shaka.getAudioTracks()` deduplicates by `originalAudioId`. When an MPD has one audio AdaptationSet with 2 bitrate Representations, each gets a different `originalAudioId` → 2 entries for what is user-perceivably one track. The old `getAudioLanguagesAndRoles()` approach deduped by `(language, role)` and returned 1 — but also lost the second English track in the SUP-51711 scenario (two `lang=en`, different roles). ## Test cases verified - Entry `0_xvq22ps3` (single audio, 2 bitrate Representations): audio selector now hidden (1 track → no selector). ✅ - Entry `0_e93m88sc` (English + English AD + 7 other languages): all 9 distinct tracks preserved. ✅ ## Test plan - [x] New unit tests: `_getAudioTracks deduplication` suite (2 cases) — HD flavor dedup + AD track preservation - [x] All 100 tests pass, 5 skipped (pre-existing) - [x] Build passes (no new TypeScript errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ravitshalem <31099969+ravitshalem@users.noreply.github.com> 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.
Description of the Changes
Continuation of #271
When changing audio track, use audio label (display name) to distinguish between audio tracks with the same language (short name)
Resolves SUP-51711