Skip to content

feat(trailer): support background hero trailer playback on Windows desktop - #598

Open
neerajlovecyber wants to merge 1 commit into
NuvioMedia:Devfrom
neerajlovecyber:feat/windows-hero-trailer-playback
Open

neerajlovecyber wants to merge 1 commit into
NuvioMedia:Devfrom
neerajlovecyber:feat/windows-hero-trailer-playback

Conversation

@neerajlovecyber

@neerajlovecyber neerajlovecyber commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds background hero trailer playback support on Windows desktop, implementing direct software-rendered video frame delivery to Compose Canvas via libmpv and Skia.

Key components:

  • Windows Native Bridge: Integrated libmpv sw render context in player_bridge.cpp with SIMD alpha masking (pixels[i] |= 0xFF000000U) to guarantee 100% pixel opacity without double-exposure.
  • Skia Surface Player: Created NativeMpvSurfacePlayer and NativeMpvSurfaceBridge allocating a shared Skia Bitmap memory buffer, rendering cleanly to Compose Canvas with a first-frame ready callback.
  • Aspect Ratio & Fill: Configured panscan=1.0 in libmpv to maintain aspect ratio and crop to fill without distortion.
  • Streaming & Performance: Prioritized direct adaptive audio/video streams over HLS on Windows for instant (~1–2s) start times, enabled WebM/VP9/Opus formats, and optimized probe reachability checks.
  • Scroll-Aware Fade: Added smooth fade-to-poster when scrolling past hero or when idle (playWhenReady == false), preventing paused video frames from lingering behind detail content.

PR type

  • Reproducible bug fix
  • UI glitch/bug fix
  • Behavior bug/regression fix
  • Small maintenance only, with no UI or behavior change
  • Docs accuracy fix
  • Translation/localization only
  • Approved larger or directional change

Why

Desktop previously lacked trailer preview playback on the media details page on Windows. This adapts the feature already present on NuvioTV for desktop navigation, allowing users to seamlessly preview trailers while viewing media details.

Desktop scope

Windows (windowsDesktopMain, desktopMain, and player_bridge.cpp), with matching scroll-fade handling in nonWindowsDesktopMain.
Zero changes to common/mobile shared files (commonMain is 100% untouched).

Issue or approval

Related to #316

UI / behavior impact

  • No UI change
  • No behavior change
  • UI changed only to fix a documented glitch/bug
  • Behavior changed only to fix a documented bug/regression
  • UI change has explicit maintainer approval
  • Behavior change has explicit maintainer approval

Policy check

  • I have read and understood CONTRIBUTING.md.
  • This PR is small, focused, and limited to one problem.
  • This PR is scoped to the desktop app, desktop packaging, desktop documentation, or shared code required for desktop behavior.
  • This PR is not cosmetic-only.
  • Any UI change fixes a linked glitch/bug and includes visual proof, or this PR has no UI change.
  • Any behavior change fixes a linked bug/regression or has explicit approval, or this PR has no behavior change.
  • This PR does not bundle unrelated refactors, cleanups, formatting, or drive-by changes.
  • This PR does not add dependencies, architecture changes, migrations, or product-direction changes without explicit approval.
  • I listed the testing performed below.

Scope boundaries

  • Only activates hero trailer surface on Windows where native libmpv bridge is available.
  • Does not modify any shared common code (commonMain).
  • Does not change trailer selection heuristics or mobile playback pipelines.

Testing

  • OS: Windows 11 (x86_64).
  • Verified playback across multiple titles (e.g. Breaking Bad, The Wire, Black Clover).
  • Verified instant start time (~1–2s) via prioritized direct adaptive streams.
  • Verified smooth crossfade on scroll down: fades video to 0f, revealing static backdrop artwork, and resumes on scroll back to top.
  • Verified mute/unmute and aspect-ratio crop to fill (panscan=1.0).
  • Automated unit test suite: passed (NativeMpvSurfacePlayerTest).

Screenshots / Video

Verified on Windows 11 desktop: hero trailer plays in the background behind media details and smoothly crossfades to the backdrop artwork when scrolling down.

clideo_editor_6618e3ed975248b7bbbd4f86b57d2146.mp4

Breaking changes

None.

Linked issues

Fixes #316

@Raquo116

Raquo116 commented Sep 3, 2026

Copy link
Copy Markdown

Not implemented in Mac OS desktop.

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.

[Feature Adaptation]: Idle background trailer playback on Details Page (Desktop equivalent to TV focus autoplay)

2 participants