From 8afbae1e1a881c7c06792f1f297aede5c28feacb Mon Sep 17 00:00:00 2001 From: Jannik Date: Thu, 17 Jun 2021 19:36:13 +0200 Subject: [PATCH] set pip source hint & update exo player * exo player 2.14.0 -> 2.14.1 --- app/build.gradle | 10 +++++----- .../mosad/teapod/ui/activity/player/PlayerActivity.kt | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b686fa2..b0b1ebd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -55,11 +55,11 @@ dependencies { implementation 'com.google.android.material:material:1.3.0' implementation 'com.google.code.gson:gson:2.8.7' - implementation 'com.google.android.exoplayer:exoplayer-core:2.14.0' - implementation 'com.google.android.exoplayer:exoplayer-hls:2.14.0' - implementation 'com.google.android.exoplayer:exoplayer-dash:2.14.0' - implementation 'com.google.android.exoplayer:exoplayer-ui:2.14.0' - implementation 'com.google.android.exoplayer:extension-mediasession:2.14.0' + implementation 'com.google.android.exoplayer:exoplayer-core:2.14.1' + implementation 'com.google.android.exoplayer:exoplayer-hls:2.14.1' + implementation 'com.google.android.exoplayer:exoplayer-dash:2.14.1' + implementation 'com.google.android.exoplayer:exoplayer-ui:2.14.1' + implementation 'com.google.android.exoplayer:extension-mediasession:2.14.1' implementation 'org.jsoup:jsoup:1.13.1' implementation 'com.github.bumptech.glide:glide:4.12.0' diff --git a/app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerActivity.kt b/app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerActivity.kt index 15916fa..66728f4 100644 --- a/app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerActivity.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerActivity.kt @@ -7,6 +7,7 @@ import android.app.PictureInPictureParams import android.content.Intent import android.content.pm.PackageManager import android.content.res.Configuration +import android.graphics.Rect import android.os.Build import android.os.Bundle import android.util.Log @@ -145,8 +146,15 @@ class PlayerActivity : AppCompatActivity() { } else { val width = model.player.videoFormat?.width ?: 0 val height = model.player.videoFormat?.height ?: 0 + val contentFrame: View = video_view.findViewById(R.id.exo_content_frame) + val contentRect = with(contentFrame) { + val (x, y) = intArrayOf(0, 0).also(::getLocationInWindow) + Rect(x, y, x + width, y + height) + } + val params = PictureInPictureParams.Builder() .setAspectRatio(Rational(width, height)) + .setSourceRectHint(contentRect) .build() enterPictureInPictureMode(params) }