set pip source hint & update exo player
* exo player 2.14.0 -> 2.14.1
This commit is contained in:
parent
164db8ebd1
commit
8afbae1e1a
|
@ -55,11 +55,11 @@ dependencies {
|
||||||
|
|
||||||
implementation 'com.google.android.material:material:1.3.0'
|
implementation 'com.google.android.material:material:1.3.0'
|
||||||
implementation 'com.google.code.gson:gson:2.8.7'
|
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-core:2.14.1'
|
||||||
implementation 'com.google.android.exoplayer:exoplayer-hls:2.14.0'
|
implementation 'com.google.android.exoplayer:exoplayer-hls:2.14.1'
|
||||||
implementation 'com.google.android.exoplayer:exoplayer-dash:2.14.0'
|
implementation 'com.google.android.exoplayer:exoplayer-dash:2.14.1'
|
||||||
implementation 'com.google.android.exoplayer:exoplayer-ui:2.14.0'
|
implementation 'com.google.android.exoplayer:exoplayer-ui:2.14.1'
|
||||||
implementation 'com.google.android.exoplayer:extension-mediasession:2.14.0'
|
implementation 'com.google.android.exoplayer:extension-mediasession:2.14.1'
|
||||||
|
|
||||||
implementation 'org.jsoup:jsoup:1.13.1'
|
implementation 'org.jsoup:jsoup:1.13.1'
|
||||||
implementation 'com.github.bumptech.glide:glide:4.12.0'
|
implementation 'com.github.bumptech.glide:glide:4.12.0'
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.app.PictureInPictureParams
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
|
import android.graphics.Rect
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
@ -145,8 +146,15 @@ class PlayerActivity : AppCompatActivity() {
|
||||||
} else {
|
} else {
|
||||||
val width = model.player.videoFormat?.width ?: 0
|
val width = model.player.videoFormat?.width ?: 0
|
||||||
val height = model.player.videoFormat?.height ?: 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()
|
val params = PictureInPictureParams.Builder()
|
||||||
.setAspectRatio(Rational(width, height))
|
.setAspectRatio(Rational(width, height))
|
||||||
|
.setSourceRectHint(contentRect)
|
||||||
.build()
|
.build()
|
||||||
enterPictureInPictureMode(params)
|
enterPictureInPictureMode(params)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue