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

Video playback in landscape orientation crashes the app #59

Open
SigmanZero opened this issue Apr 18, 2024 · 0 comments
Open

Video playback in landscape orientation crashes the app #59

SigmanZero opened this issue Apr 18, 2024 · 0 comments
Assignees

Comments

@SigmanZero
Copy link
Contributor

I noticed SociaLite was crashing when starting video playback in landscape orientation, and I think this line configuring the PiP window is causing the error: https://github.com/android/socialite/blob/main/app/src/main/java/com/google/android/samples/socialite/ui/player/VideoPlayerScreen.kt#L182

On the device I was testing with, it seems we're getting width 2340 and height 790, which is an aspect ratio of 2.96 and outside the 2.39:1 - 1:2.39 bounds that are accepted https://developer.android.com/reference/android/app/PictureInPictureParams.Builder#setAspectRatio%28android.util.Rational%29

Some possible solutions:

  • Clamp the aspect ratio to the accepted range 2.39:1 - 1:2.39
  • Remove the line explicitly setting the aspect ratio
  • I'm inclined to guess we're not actually using the video size when calculating this aspect ratio - this might require setting up a listener to properly update the PiP window aspect ratio once ExoPlayer has finished preparing the video
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

No branches or pull requests

2 participants