Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PiP aspect ratio issue #57

Merged
merged 3 commits into from
Apr 23, 2024
Merged

Fix PiP aspect ratio issue #57

merged 3 commits into from
Apr 23, 2024

Conversation

MagicalMeghan
Copy link
Contributor

Fixing the PiP issue where the app crashes when the app starts playing a video from landscape mode.

Fix for PiP aspect ratio issue
@SigmanZero
Copy link
Contributor

Tested with a Pixel Fold - not seeing a crash when trying landscape playback now, thank you!

Copy link

@neelanshsahai neelanshsahai left a comment

Choose a reason for hiding this comment

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

Minor changes requested

new fix based off of the player's video size
Copy link

@wu-perry wu-perry left a comment

Choose a reason for hiding this comment

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

LGTM

@hwwang-google
Copy link

LGTM

// set source rect hint, aspect ratio
if (player != null && player.videoSize.width > 0 && player.videoSize.height > 0) {
val sourceRect = layoutCoordinates.boundsInWindow().toAndroidRectF().toRect()
builder.setSourceRectHint(sourceRect)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ideally, this source rect hint would also be set based on the playback surface's bounds - right? I'm not sure how we can do that though, since the PlayerView is created after we set up the pip modifier, and we use the pip modifier when declaring the PlayerView (i.e. it seems like a chicken and egg situation).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had a similar thought - it is definitely worth looking into!

@SigmanZero
Copy link
Contributor

Tested with both a landscape and a portrait video, in both landscape and portrait device orientations - fix LGTM, thank you!

@MagicalMeghan MagicalMeghan merged commit 2531db7 into main Apr 23, 2024
2 checks passed
@MagicalMeghan MagicalMeghan deleted the pip-aspect-ratio-fix branch April 23, 2024 20:34
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.

5 participants