Skip to content

Conversation

@Zakariasma
Copy link

Summary

This PR adds a new prop pictureInPictureResizeMode to control the video scaling in Picture-in-Picture (PiP) mode on Android. This helps prevent white bars when the video aspect ratio does not match the PiP window.

Motivation

Previously, videos with an aspect ratio different from the PiP window could display white bars. By introducing pictureInPictureResizeMode, developers can explicitly set how the video should scale (e.g., cover, contain, stretch) in PiP mode.

Changes

  • Added pictureInPictureResizeMode prop in React Native Video.
  • Updated Android PiP handling to use this prop.
  • Ensures videos fill the PiP window according to the selected scaling mode, avoiding white bars.

Test plan

  1. Launch the example app on an Android device that supports PiP.
  2. Set the pictureInPictureResizeMode prop to cover, contain, or stretch.
  3. Enter PiP mode with a video whose aspect ratio differs from the PiP window.
  4. Verify the video scales correctly according to the prop and no white bars appear.
  5. Ensure smooth playback and no crashes.

Copy link
Collaborator

@KrzysztofMoch KrzysztofMoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, but I see that linter is failing - can you lint code? Thanks!

@Zakariasma
Copy link
Author

The Ktlint build is failing because of the file ReactExoplayerSimpleCache.kt.
The issue comes from Kotlin, the object RNVSimpleCache defined in this file must be declared in a file named RNVSimpleCache.kt, otherwise Ktlint considers it a convention violation.

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

Labels

None yet

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

2 participants