[Android] PiP: Prevent IllegalArgumentException

Geoffrey Métais git at videolan.org
Wed Mar 11 13:32:02 CET 2020


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 11 13:23:45 2020 +0100| [1fc9160b17054dc81ea1919dcdf3be4ff6c04371] | committer: Geoffrey Métais

PiP: Prevent IllegalArgumentException

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

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

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index 5b20ec576..0764df21b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -1478,7 +1478,9 @@ open class VideoPlayerActivity : AppCompatActivity(), PlaybackService.Callback,
         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