Skip to content

Create control to close the player and exit the current page like Instagram - #600

Open
AhmadFalahian wants to merge 567 commits into
feature-add-new-cupertino-skip-buttonsfrom
master
Open

AhmadFalahian wants to merge 567 commits into
feature-add-new-cupertino-skip-buttonsfrom
master

Conversation

@AhmadFalahian

Copy link
Copy Markdown

There is no control in your player to close the video player. For example, suppose we are in full screen mode and we want to stop the whole player and exit it by pressing the close button, like the mode that Instagram has for its own player.

@diegotori

diegotori commented Feb 17, 2022 •

Copy link
Copy Markdown
Collaborator

@AhmadFalahian Looks like this change needs to be scoped to just the changes to the player. Please fork from master, then re-submit this PR. Thank in advance.

vaishnavi-2301 and others added 29 commits July 4, 2024 00:48
…n material_controls.dart and material_desktop_controls.dart
Fix the logic of the Center Play Button icon selection
Adding Seek buttons for Android
add video_player import otherwise the VideoPlayerController is not available.
Introduced `showSubtitlesPerDefault` in `ChewieController` to allow disabling subtitles by default. Updated controls to respect the flag and aligned behavior across platforms. Added documentation.

Closes #648
Introduced `showSubtitlesPerDefault` in `ChewieController` to allow disabling subtitles by default. Updated controls to respect the flag and aligned behavior across platforms. Added documentation.

Closes #648
diegotori and others added 30 commits September 16, 2026 15:44
Add typed video-quality selection to the options menu of all three skins
Mobile (MaterialControls):
- Double-tapping the left/right side of the video seeks backward/forward,
  flashing the accumulating seek indicator. The middle band is a dead zone.
- While the indicator is visible, further single taps in the same zone keep
  seeking (10s -> 20s -> 30s), like YouTube.
- Gated by ChewieController.allowDoubleTapSeek (default true) with the step
  set by ChewieController.doubleTapSeekDuration (default 10s). Disabled on
  live streams and when playback is finished.

Desktop (MaterialDesktopControls):
- Double-clicking the video toggles fullscreen, like the YouTube desktop
  player. Gated by ChewieController.allowDoubleTapToggleFullScreen (default
  true) and allowFullScreen.

The keyboard seek indicator state introduced by #953 moves from
_MaterialDesktopControlsState into a shared SeekIndicatorStateMixin so both
control sets drive the same SeekIndicator.

Double-tap-to-seek was first explored by punit1111 in #717.
pauseOnBackgroundTap, the display-tapped hide toggle, and the backward
tap-to-repeat zone check were the 8 lines codecov flagged as uncovered
in material_controls.dart's patch.
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>
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>
The Flutter 3.47 upgrade enabled prefer_initializing_formals. Keeps the
fields private, matching _PlaybackSpeedDialog in cupertino_controls.dart;
callers still pass tracks:/selectedId:.
feat: YouTube-style tap gestures (double-tap seek zones on mobile, double-click fullscreen on desktop)
Generalise subtitle support beyond a single on/off cue list: the controller
now holds a source-agnostic list of selectable SubtitleTracks, an active id
and an onSubtitleTrackChanged callback, plus a liveSubtitle ValueNotifier for
streaming sources (e.g. HLS) that emit cue text over time.

- ChewieController: subtitleTracks / activeSubtitleTrackId /
  onSubtitleTrackChanged / liveSubtitle, setSubtitleTracks, selectSubtitleTrack,
  setLiveSubtitle; copyWith + dispose wired.
- Material + Material desktop controls: a Subtitles entry in the options menu
  opening a track picker, live-cue rendering reusing subtitleBuilder, and a
  track-aware toggle.
- SubtitleTrackDialog widget + SubtitleTrack model.
Adds unit and widget tests for the new subtitle-track API:
- SubtitleTrack model (equality, hashCode, toString)
- SubtitleTrackDialog (rendering, selection, custom off label, dismissal)
- ChewieController track methods (setSubtitleTracks, selectSubtitleTrack,
  setLiveSubtitle, copyWith, dispose, hasSubtitleTracks)
- Material and desktop controls: toggle-driven selection, options-menu
  track picker, live-cue and static-cue rendering, custom subtitleBuilder

Brings patch coverage to ~99%.
The Material controls passed the optionsTranslation subtitle label into the
SubtitleTrackDialog's "off" entry, but the desktop controls always showed the
hardcoded "Off". Mirror the Material behavior so both variants honor
optionsTranslation.subtitlesButtonText.
The Flutter 3.47 upgrade enabled prefer_initializing_formals. Keeps the
fields private, matching _PlaybackSpeedDialog in cupertino_controls.dart;
callers still pass tracks:/selectedId:.
selectSubtitleTrack and setSubtitleTracks notify ChewieController, but the
Material and desktop controls only listened to the video controller, so
_subtitleOn never moved when the host drove selection from code instead of a
UI tap. Since _buildSubtitleLayer bails out on !_subtitleOn, a programmatic
selection rendered no cues at all until the user tapped the toggle — the
common path for HLS, where tracks are discovered from the manifest.

Listen to ChewieController in both controls and mirror activeSubtitleTrackId
into _subtitleOn. Guarded on hasSubtitleTracks so the legacy single-subtitle
toggle keeps its current behaviour, and on an actual value change so the
other notifyListeners callers don't trigger spurious rebuilds.
The bottom bar is wrapped in a SafeArea, but the top bar was not, so outside
fullscreen its buttons (mute, cast, additional controls) sat under a notch or
status rail on devices with a side inset. Pad the top bar by the side insets
only, since the player often sits below the embedder's own header where the
top inset has already been accounted for.

Fixes #971

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The position label was a loose Flexible next to a Spacer; the two split
the free space and the label's unused share sat after the controls.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
fix: keep the desktop bar's right-hand controls pinned right
…e-area

fix: keep the Cupertino top bar clear of the side safe-area insets
The chapter label was centered on the pointer with no clamp and no width
limit, so near either end of the bar half of it fell outside the player
and any rounded clip around the player cut it off; long titles overflowed
the player too.

Measure the label, clamp its left edge to [0, barWidth - labelWidth] so it
stops flush with the edges while the pointer slides under it (YouTube
behaviour), and cap its width at the bar width so long titles ellipsize
inside the player. Same code path for hover and drag, and for the three
skins.
…e-bar

fix: keep the hovered chapter label inside the progress bar
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.