feat: multi-track audio selection#949
Open
Ortes wants to merge 3 commits into
Open
Conversation
Mirror the subtitle-track support for audio: the controller now holds a source-agnostic list of selectable AudioTracks, an active id and an onAudioTrackChanged callback. Unlike subtitles, audio is never "off" — one track is always active, and the menu entry only shows when more than one track exists. - ChewieController: audioTracks / activeAudioTrackId / onAudioTrackChanged / hasAudioTracks, setAudioTracks, selectAudioTrack; copyWith wired. - Material + Material desktop controls: an Audio entry in the options menu opening a track picker. - AudioTrackDialog widget + AudioTrack model. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #949 +/- ##
==========================================
+ Coverage 43.82% 52.83% +9.01%
==========================================
Files 21 23 +2
Lines 1602 1675 +73
==========================================
+ Hits 702 885 +183
+ Misses 900 790 -110 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add tests for the new audio-track feature so the patch is exercised and codecov/patch stops reporting 0% on the changed lines: - AudioTrack model: equality, hashCode, toString, optional language - ChewieController: hasAudioTracks, setAudioTracks, selectAudioTrack, copyWith propagation, onAudioTrackChanged callback - AudioTrackDialog widget: tile rendering, selection check icon, language hint, tap-to-pick and dismiss-with-null - MaterialControls & MaterialDesktopControls: options menu surfaces the Audio entry only when >1 track and drives selection end to end Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Motivation
Streaming sources (notably HLS) expose multiple audio renditions (languages, commentary, codecs) in their manifest, but Chewie has no UI to switch between them. This adds a source-agnostic audio-track picker to the Material controls.
What this adds
The widget is source-agnostic: the host populates the track list and performs the actual rendition switch; Chewie never assumes HLS or any particular backend.
API (all opt-in — defaults preserve current behavior)
ChewieController:List<AudioTrack> audioTracks— selectable tracks (default empty).Object? activeAudioTrackId— currently selected id.void Function(AudioTrack)? onAudioTrackChanged— selection callback.setAudioTracks()/selectAudioTrack()— for tracks known only after load.bool get hasAudioTracks— true only whenlength > 1; gates the menu entry.New:
AudioTrackmodel andAudioTrackDialogbottom sheet.Backwards compatibility
Fully backwards compatible — every field is optional and defaults to the current behavior. No menu entry appears unless the host provides more than one track.
Testing
dart analyze— no issues.Independent of the subtitle-track PR (#948) — single commit, based on
master.