android / socialite

Apache License 2.0
346 stars 60 forks source link

Video playback in landscape orientation crashes the app #59

Closed SigmanZero closed 4 months ago

SigmanZero commented 4 months ago

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:

SigmanZero commented 4 months ago

Fixed by @MagicalMeghan in PR #57 - thank you!