Files
shaka-player/ui/externs
MultiViewer 5717432206 feat(ui): add customTrackLabel callback for overriding track labels (#9904)
## Summary
- Adds a `customTrackLabel` callback to the UI configuration that allows
overriding track labels for both audio and text tracks
- The callback receives the default label (or `null` if the language was
unrecognized), the track object, and a type string (`'audio'` or
`'text'`)
- Returning a string overrides the label; returning falsy keeps the
default behavior

Fixes #9821

## Example usage
```javascript
ui.configure({
  customTrackLabel: (defaultLabel, track, type) => {
    if (track.language === 'fx') return 'Sound Effects';
    return null; // use default
  }
});
```

## Test plan
- Added integration tests verifying label override, null for
unrecognized languages, type argument, and fallback behavior
- Tests pass in both compiled and uncompiled modes

## AI Disclosure
As highlighted in the new `AGENT-ATTRIBUTION.md`, I've added Claude as a
co-author of the commit as I made use of it during this PR.

Signed-off-by: F1 MultiViewer <f1multiviewer@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-03-29 14:18:06 -07:00
..