Skip to content

Add aspect ratio selector to video player#50

Open
4in4in wants to merge 1 commit into
InfinityLoop1308:devfrom
4in4in:feature/aspect-ratio-selector
Open

Add aspect ratio selector to video player#50
4in4in wants to merge 1 commit into
InfinityLoop1308:devfrom
4in4in:feature/aspect-ratio-selector

Conversation

@4in4in

@4in4in 4in4in commented Jun 12, 2026

Copy link
Copy Markdown

What

Adds an aspect ratio selector to the main video player, next to the existing resize mode (FIT/FILL/ZOOM) button.

  • Auto (default) — use the video's own aspect ratio
  • 1:1, 4:3, 16:9, 18:9, 21:9 — force a fixed ratio
  • Custom… — dialog accepting 16:9, 16/9 or decimal 1.78 input

Why

Some videos are uploaded with wrong proportions (typically old 4:3 content stretched to 16:9, or anamorphic video without proper metadata). The resize modes can't fix that — they change how the video fits the screen, not the picture's own proportions. Forcing the correct ratio is the only way to watch such videos undistorted. VLC and MX Player offer the same control.

Behavior details

  • The choice is per-video: it resets to Auto when playback moves to a different stream. A forced ratio is a correction for a specific broken video, so it intentionally doesn't persist (avoids the "why is everything stretched now" trap).
  • Quality changes of the same stream do not reset the choice (the reset hooks into onMetadataChanged, which only fires when the stream URL actually changes).
  • Vertical-video detection and screen rotation still use the stream's natural dimensions.
  • The button is hidden in the popup player, same as the resize mode button.

@4in4in 4in4in force-pushed the feature/aspect-ratio-selector branch 2 times, most recently from 0533094 to 3d9ff44 Compare June 12, 2026 15:19
@InfinityLoop1308

Copy link
Copy Markdown
Owner

Thanks. The feature is a good addition, but I think there is a UI semantics issue here.

The aspect ratio selector should be part of the same menu as the existing resize mode selector. In the
current design, if resize mode is set to Fill, the selected aspect ratio has no effect, which is misleading.

I would recommend keeping a single display-mode menu:

  • Fit / Fill / Zoom, as before
  • 1:1 / 4:3 / ... / Custom, newly added

When one of the aspect-ratio entries is selected, the player should apply that ratio with resize mode set to
Fit.

The reset strategy can remain the same: last_resize_mode still persists, while the forced aspect ratio
resets per video as proposed.

@4in4in 4in4in force-pushed the feature/aspect-ratio-selector branch from 3d9ff44 to 5a093c6 Compare June 14, 2026 12:44
Fold a forced-aspect-ratio selector into the existing resize button so
there is a single display-mode menu instead of two separate controls:

    Fit / Fill / Zoom        (resize modes, as before)
    ──────────
    1:1 / 4:3 / 16:9 / 18:9 / 21:9 / Custom…   (forced aspect ratios)

Selecting a resize mode applies it, is persisted to last_resize_mode, and
clears any forced ratio (so a ratio can never silently have no effect).
Selecting an aspect ratio applies it with the resize mode set to Fit; this
Fit is per-video and not persisted, so the saved resize mode is restored
on the next video while the forced ratio resets per video. Custom accepts
'16:9', '16/9' or '1.78'. Useful for videos uploaded with wrong
proportions (e.g. 4:3 content stretched to 16:9). Hidden in the popup
player, like the resize button.

The two groups are separated with a menu divider, and the currently
active entry is checked (the resize mode when no ratio is forced, the
matching ratio otherwise, or Custom for a non-preset value); the menu is
rebuilt on each open to keep the checkmark in sync.
@4in4in 4in4in force-pushed the feature/aspect-ratio-selector branch from 5a093c6 to fb263d5 Compare June 14, 2026 12:45
@4in4in

4in4in commented Jun 14, 2026

Copy link
Copy Markdown
Author

Thanks for the review — makes sense, fixed.

There's now a single display-mode menu opened from the resize button, no separate control:

Fit / Fill / Zoom
──────────
1:1 / 4:3 / 16:9 / 18:9 / 21:9 / Custom…

  • Selecting an aspect ratio applies it with resize mode set to Fit, so it can never silently have no effect.
  • Selecting a resize mode clears any forced ratio.
  • Reset strategy as you suggested: last_resize_mode persists; the forced aspect ratio is per-video. The Fit forced by a ratio is transient (not persisted), so the saved resize mode is restored on the next video.

Also added a divider between the two groups and a checkmark on the currently active entry.

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