[Android] PiP: Prevent IllegalArgumentException

Geoffrey Métais git at videolan.org
Wed Mar 11 14:17:28 CET 2020


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 11 14:06:44 2020 +0100| [e8061a921dcdfa38fbc3da2dd0e279b49340eef0] | committer: Geoffrey Métais

PiP: Prevent IllegalArgumentException

> https://code.videolan.org/videolan/vlc-android/commit/e8061a921dcdfa38fbc3da2dd0e279b49340eef0
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index fdaa37949..7c5516e66 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -1575,7 +1575,9 @@ open class VideoPlayerActivity : AppCompatActivity(), IPlaybackSettingsControlle
         if (isInPictureInPictureMode && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
             val track = service?.playlistManager?.player?.mediaplayer?.currentVideoTrack ?: return
             val ar = Rational(track.width.coerceAtMost((track.height * 2.39f).toInt()), track.height)
-            setPictureInPictureParams(PictureInPictureParams.Builder().setAspectRatio(ar).build())
+            if (ar.isFinite && !ar.isZero) {
+                setPictureInPictureParams(PictureInPictureParams.Builder().setAspectRatio(ar).build())
+            }
         }
     }
 



More information about the Android mailing list