Skip to content

Add typed video-quality selection to the options menu of all three skins - #965

Merged
diegotori merged 3 commits into
fluttercommunity:masterfrom
Fullphysio:feat/video-quality-selection
Sep 16, 2026
Merged

diegotori merged 3 commits into
fluttercommunity:masterfrom
Fullphysio:feat/video-quality-selection

Conversation

@Ortes

@Ortes Ortes commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Stacked on #963 — the first commit here is that PR; review only the last commit(s). Rebase this branch once #963 lands.

What this adds

A typed, host-driven video-quality picker, closing the long-standing ask in #852 and superseding #492 and #867:

ChewieController(
  videoPlayerController: controller,
  videoQualities: const [
    VideoQuality(id: '480', label: '480p'),
    VideoQuality(id: '1080', label: '1080p'),
  ],
  activeVideoQualityId: '1080',
  onVideoQualityChanged: (quality) {
    chewieController.swapVideoSource(
      VideoPlayerController.networkUrl(urlFor(quality)),
    );
  },
);
  • VideoQuality {id, label} — id is opaque to chewie (a URL, an HLS rendition index, …).
  • A Quality entry in the options menu of all three skins — Material, Material desktop, and Cupertino — with a selection dialog marking the active quality. Hidden until more than one quality is supplied (hasVideoQualities).
  • setVideoQualities(...) for qualities known only after a manifest parses; selectVideoQuality(...) for programmatic selection; all three fields carried through copyWith.
  • OptionsTranslation.qualityButtonText for i18n.

Design: why not a Map<String, String> of label → URL?

That's the shape #492 and #867 used, and it's the reason both stalled: it can't express HLS/DASH rendition switching (one URL, many qualities), per-quality headers or DRM, or qualities discovered after load — and it forces chewie to own controller recreation, the exact concern raised in the #867 review. Instead, chewie owns the UI and selection state, and the host owns the switch — for the common separate-files case that's the three-line swapVideoSource call from #963 shown above (demoed in the example app). This mirrors the shape of the subtitle/audio track proposals in #948/#949, so the three "pick one variant" features stay one pattern.

Thanks @akmalova (#867) and @merdweebner (#492) for the groundwork.

Tests

Unit tests for the controller surface (gating, set/select semantics, notifications, copyWith) and Material widget tests: menu gating, active-quality check mark, host callback on selection, and the qualityButtonText override.

@codecov

codecov Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.21429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.70%. Comparing base (7fb5885) to head (00d4b3a).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
lib/src/cupertino/cupertino_controls.dart 97.36% 1 Missing ⚠️
lib/src/material/material_controls.dart 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #965      +/-   ##
==========================================
+ Coverage   72.73%   77.70%   +4.97%     
==========================================
  Files          41       43       +2     
  Lines        2560     2687     +127     
==========================================
+ Hits         1862     2088     +226     
+ Misses        698      599      -99     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Ortes
Ortes force-pushed the feat/video-quality-selection branch 4 times, most recently from ef02e74 to b95caf1 Compare September 15, 2026 06:14
@diegotori

Copy link
Copy Markdown
Collaborator

@Ortes looks like you have conflicts. Please resolve them. Thanks.

Adds a VideoQuality model and ChewieController support for it
(videoQualities, activeVideoQualityId, onVideoQualityChanged,
setVideoQualities, selectVideoQuality), with a Quality entry and
selection dialog in the Material, Material desktop and Cupertino
controls, plus an OptionsTranslation.qualityButtonText override.

Chewie owns the menu and the selection state; switching the stream is
left to the host via onVideoQualityChanged — typically a
swapVideoSource call for separate files per quality, or a rendition
switch on an adaptive stream. The menu stays hidden until more than
one quality is supplied.
Widget tests for the Cupertino and Material desktop quality flows
(gating, active check mark, host callback, translated button text, the
options-button gate for additionalOptions), plus unit tests for
VideoQuality equality and the OptionsTranslation.qualityButtonText
plumbing. The selection tests run while playing so the hide-timer
restart paths are exercised too.
@Ortes
Ortes force-pushed the feat/video-quality-selection branch from b95caf1 to 00d4b3a Compare September 16, 2026 19:32

@diegotori diegotori left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

@diegotori
diegotori merged commit 858771f into fluttercommunity:master Sep 16, 2026
5 checks passed
diegotori added a commit that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants