Skip to content

Subtitle size/position computed from player view bounds, not displayed video rect (orientation-dependent sizing, cues in letterbox) #32

Closed

Description

@zZebrahz

Summary

Parity follow-up from the silo-apple subtitle geometry work: on Android, subtitle text size and position are computed against the full player view bounds, not the displayed video rectangle. The Apple clients had the same class of bug (font tiny in landscape, huge in portrait, subs rendered in the letterbox area) and fixed it by sizing/positioning the subtitle overlay to the aspect-fitted video rect.

Current behavior

android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/SubtitleManager.kt:163-167:

subtitleView.setFractionalTextSize(
    fractionalSizeFor(safe.fontSize),
    /* fractionalRelativeToTextSize = */ false,
)
subtitleView.setBottomPaddingFraction(bottomPaddingFor(safe.position))

Media3's SubtitleView measures fractional text size against its own height, and PlayerView lays the subtitle view across the whole PlayerView, not the AspectRatioFrameLayout content frame. Consequences (mainly the phone app, where orientation changes the view aspect):

  • Portrait fullscreen with a 16:9 video: the view is much taller than the displayed video, so the same preset renders much larger relative to the video than in landscape, and subtitles/bottom padding land in the black letterbox area below the video instead of inside the frame.
  • Landscape: sizes are computed against the (video-matching) view height, so it looks right — which makes the portrait discrepancy feel like random inconsistency to users.

The TV app is mostly immune in Fit on 16:9 content, but Zoom/Stretch and non-16:9 content still shift the relationship between view height and video height.

What Apple did (for reference)

  • Compute the displayed video rect (aspect-fit of the video size into the surface bounds) and size/position the subtitle overlay to that rect, so subtitle scale follows the video, is orientation-invariant, and cues render inside the video frame. silo-apple commits 22a1567, 71e275a, cfd4658 (branch subtitles); the helper is a trivial AVMakeRect-style aspect-fit.
  • After switching to video-relative sizing, the preset ladder needed rebasing (~1.4x) so "Large" visually matches the old "XX-Large". Expect the same: if SubtitleView is laid out to the video rect, retune fractionalSizeFor so the presets visually match the Apple clients (and roughly Plex) at each step. Note SubtitleFontSizePreset.pointSize in shared/.../SubtitleAppearance.kt:17-24 appears unused on Android and is now out of sync with Apple's rebased ladder — either align or remove it.

Suggested approach

Listen for video size / aspect changes (PlayerView already manages AspectRatioFrameLayout), compute the aspect-fitted video rect for the current resize mode, and constrain the SubtitleView layout to that rect (respecting Zoom/Stretch by falling back to full bounds, matching the Apple behavior for fill gravity). Then retune the fractional presets against the Apple/Plex reference.

Activity

  1. zZebrahz commented on Jul 3, 2026

    @zZebrahz
    ContributorAuthor

    I can handle this later, was just filing a note

  2. added
    bug
    triaged
    and removed
    triaged
    on Sep 20, 2026
  3. added theissue type on Sep 20, 2026
  4. removed
    bug
    on Sep 20, 2026
  5. Quick104 commented on Oct 31, 2026

    @Quick104
    Contributor

    Fixed by #127, merged on 2026-07-28. Reopen if you still see this on a build that includes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions