Skip to content

[UI] Media bar YouTube trailer preview is zoomed and shifted on Fire TV: the WebView video overlay ignores the CSS scale (H.264 and AV1)Β #2132

Closed

Description

@leonardopieralli

Moonfin version

3.0.0

Platform

Android TV

OS version

Fire OS 8 (Android 11)

Device model

Amazon Fire TV Stick 4K 2nd gen (AFTKM, MediaTek MT8696)

Server

Jellyfin

Where does it happen?

Home

Input method

D-pad / remote

Steps to reproduce

What happens

The YouTube trailer preview in the home media bar is drawn zoomed in and shifted: the picture is offset up-left and larger than its box (black band only at the top, edges and on-screen logos cut off). Local Jellyfin trailers played through Media3 are fine. I now see it on several of my Fire TV devices.

Measured on the Fire TV while a trailer was playing (Moonfin 3.0.0)

  • Decoder: MediaCodecLogger: ...4K.HW.omx.video.avc Resolution change from 0x0 to 1920x1080 (H.264). Earlier the same happened with AV1 (...omx.video.av01), so it is not codec-specific.
  • Amazon WebView puts the <video> on a hardware overlay and logs:
    cr_SurfaceViewOverlayCore: AWV - SurfaceView X=0 Y=0 width=3840 height=2160 scaleX=2.0 scaleY=2.0 screenWidth=1920, screenHeight=1080 (SurfaceView scaling API not called; default 1.0 scaling in effect)
  • SurfaceFlinger (UI is 1920x1080):
SurfaceView - org.moonfin.androidtv/...MainActivity#0: pos=(0,0)     size=(1920,1080)  (UI)
SurfaceView - org.moonfin.androidtv/...MainActivity#1: pos=(-29,-16) size=(3840,2160)  buffer 1920x1080 (video)

The video overlay is placed from the page's unscaled 1920x1080 stage plus the 1.03 overscan offset (-29,-16), and is not scaled down with the CSS scale().

Cause (source)

  • lib/ui/widgets/web_youtube_trailer_io.dart: the player lives on a fixed _stageWidth = 1920 x _stageHeight = 1080 stage that applyScale() fits to the box with stage.style.transform = 'translate(...) scale(...)'.
  • lib/ui/widgets/media_bar.dart: the trailer is wrapped in an OverflowBox with overscan = 1.03.
  • When the WebView composites the video on a hardware overlay (Amazon WebView on Fire OS), the overlay follows the element's layout box but ignores the CSS transform, so the video is drawn at the wrong size and offset. Toggling the WebView flag WebViewSurfaceControlForTV made no difference.

Steps to reproduce

  1. Fire TV Stick 4K 2nd gen (Fire OS 8), Moonfin home with media bar trailer previews enabled.
  2. Wait for a YouTube trailer to start in the media bar.
  3. The trailer is drawn zoomed and shifted (see screenshots).

Possible fixes

  • Size the stage to the real box (window.innerWidth x window.innerHeight) instead of scaling a fixed 1920x1080 stage, and drop the 1.03 overscan on Android TV / Fire TV; request quality from YouTube (e.g. vq=hd1080) instead of relying on the stage size.
  • Or offer an option to skip the embedded WebView for trailer previews on Fire TV.

Screenshots / recordings

Two screenshots from the Fire TV: a media bar trailer today (H.264), picture shifted up with a black band only at the top and larger than the screen; and the same issue earlier with an AV1 trailer, logo at the top right cut off.

Image Image

Activity

  1. added
    Bug
    on Nov 5, 2026
  2. RadicalMuffinMan commented on Nov 5, 2026

    @RadicalMuffinMan
    Contributor

    Since you found the cause, submit a PR, thank you.

  3. added 2 commits that reference this issue on Nov 6, 2026
    dce1f24
    a2bcdac
  4. added a commit that references this issue on Nov 7, 2026
    b78216e
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

    Android TVBugJellyfinUI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions