Skip to content

fix(trailer): resolve iOS popup dimensions and polyfill native playback controls#1278

Open
luqmanfadlli wants to merge 7 commits into
NuvioMedia:cmp-rewritefrom
luqmanfadlli:fix-ios-popup-trailer
Open

fix(trailer): resolve iOS popup dimensions and polyfill native playback controls#1278
luqmanfadlli wants to merge 7 commits into
NuvioMedia:cmp-rewritefrom
luqmanfadlli:fix-ios-popup-trailer

Conversation

@luqmanfadlli

Copy link
Copy Markdown
Contributor

Summary

The in-app trailer popup was suffering from two major issues on iOS:

  • Layout Collapse: The UIKitViewController requires strict bounding boxes from Compose to render correctly. By using Modifier.fillMaxWidth() inside TrailerPlayerPopup.kt, the player surface failed to properly inherit the height from its 16:9 parent Box, causing rendering anomalies.
  • Missing Interactivity: Because MPV acts purely as a rendering engine, passing useNativeController = true left the iOS player completely unresponsive to touch inputs, trapping the user in an un-pausable video playback.

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

The changes in TrailerPlayerPopup.kt is needed to make the trailer popup usable on iOS. Without it, the player surface collapses visually. As for changes in PlayerEngine.ios.kt needed to the user a button to pause/un-pause playback because MPV does not ship with built-in native playback controls like Android's ExoPlayer.

Issue or approval

Fixes #1277

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 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.

UI polish, cosmetic-only changes, minor behavior tweaks, and unapproved product changes will be closed without review.

Scope boundaries

Intentionally did not modify the shared PlatformPlayerSurface signature or add new properties. The UI polyfill is strictly scoped to the iOS source set (PlayerEngine.ios.kt) to guarantee zero impact on Android, ensuring ExoPlayer's robust native UI remains completely unobstructed.

Testing

Tested trailer popup playback on iPhone, iPad, and Android.

Before this change:

  • trailer popup could render blank on iOS;
  • MPV bridge could wait on invalid native view bounds;
  • iOS did not provide usable trailer popup playback controls.

After this change:

  • trailer popup video renders correctly on iOS;
  • the native player surface receives valid bounds;
  • MPV proceeds with loadfile;
  • iOS trailer popup has playback controls;
  • Android remains unaffected because the added controls are iOS-only.

Screenshots / Video

Not a UI change

Breaking changes

None

Linked issues

Fixes #1277

The previous popup layout only applied fillMaxWidth() to PlatformPlayerSurface, which could leave the underlying native UIView with zero-height bounds on iOS. As a result, the MPV bridge queued the trailer load but never issued the loadfile command because the player view was not ready.

This changes ensure the trailer popup player surface fills its 16:9 container on iOS and Android.
MPV lacks a built-in native playback controller on iOS. Previously, passing `useNativeController = true` like being used in `TrailerPlayerPopup.kt` resulted in a bare video surface with no user interaction.

This commit injects a custom Compose touch overlay (play/pause control) directly into `PlayerEngine.ios.kt` when native controls are requested. By isolating this polyfill to the iOS source set, we prevent touch event interception issues on Android, ensuring ExoPlayer's robust native UI remains fully functional and unobstructed.
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.

[Bug]: iOS trailer popup renders blank because native player surface receives zero-height bounds

1 participant