Skip to content

fix(SUP-51711): Audio Description Language selection not working as expected in some browsers - #271

Merged
SivanA-Kaltura merged 4 commits into
masterfrom
sup-51711
May 4, 2026
Merged

fix(SUP-51711): Audio Description Language selection not working as expected in some browsers#271
SivanA-Kaltura merged 4 commits into
masterfrom
sup-51711

Conversation

@SivanA-Kaltura

@SivanA-Kaltura SivanA-Kaltura commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Description of the Changes

  • Allow audio tracks with the same language.
  • Compute a stable audio track id without relying on getVariantTracks.
  • Use shaka getAudioTracks API to prepare for shaka v5 (where getVariantTracks and getAudioLanguagesAndRoles will be removed).

Related PR:
kaltura/playkit-js#875

Resolves SUP-51711

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Dash adapter’s audio track discovery to better support Audio Description track selection across browsers and to move toward Shaka v5-compatible APIs.

Changes:

  • Switch audio track enumeration from getAudioLanguagesAndRoles() to getAudioTracks().
  • Change how audio track ids/kinds are derived (including accessibility-based kind classification).
  • Keep using getVariantTracks() to infer accessibility purpose (with a TODO for Shaka v5).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/dash-adapter.ts
Comment thread src/dash-adapter.ts
Comment thread src/dash-adapter.ts
Comment thread src/dash-adapter.ts
Comment thread src/dash-adapter.ts
Comment thread src/dash-adapter.ts
Comment thread src/dash-adapter.ts
ravitshalem
ravitshalem previously approved these changes May 4, 2026
roeedean
roeedean previously approved these changes May 4, 2026
Comment thread src/dash-adapter.ts Outdated
@SivanA-Kaltura
SivanA-Kaltura dismissed stale reviews from roeedean and ravitshalem via 276df5b May 4, 2026 08:10
@SivanA-Kaltura
SivanA-Kaltura merged commit 92d6253 into master May 4, 2026
17 checks passed
SivanA-Kaltura added a commit to kaltura/playkit-js that referenced this pull request May 4, 2026
…xpected in some browsers (#875)

### Description of the Changes

Use label to compare audio flavor and track, fallback to flavorId if
label comparison fails.
This is needed because dash provides us limited information for
comparison.

Related PR: 
kaltura/playkit-js-dash#271

Resolves [SUP-51711](https://kaltura.atlassian.net/browse/SUP-51711)

### CheckLists

- [ ] changes have been done against master branch, and PR does not
conflict
- [ ] new unit / functional tests have been added (whenever applicable)
- [ ] test are passing in local environment
- [ ] Travis tests are passing (or test results are not worse than on
master branch :))
- [ ] Docs have been updated


[SUP-51711]:
https://kaltura.atlassian.net/browse/SUP-51711?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
SivanA-Kaltura added a commit that referenced this pull request May 5, 2026
…xpected in some browsers (#272)

### 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](https://kaltura.atlassian.net/browse/SUP-51711)


[SUP-51711]:
https://kaltura.atlassian.net/browse/SUP-51711?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
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>
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.

4 participants