set pip source hint & update exo player

* exo player 2.14.0 -> 2.14.1
This commit is contained in:
Jannik 2021-06-17 19:36:13 +02:00
parent 164db8ebd1
commit 8afbae1e1a
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
2 changed files with 13 additions and 5 deletions

View File

@ -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'

View File

@ -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)
}