minor pip mode fixes

This commit is contained in:
Jannik 2021-03-04 20:19:54 +01:00
parent 6cc59a72fc
commit 1a9de4124d
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
1 changed files with 5 additions and 5 deletions

View File

@ -127,6 +127,8 @@ class PlayerActivity : AppCompatActivity() {
// if the player was in pip, it's on a different task // if the player was in pip, it's on a different task
if (wasInPiP) { navToLauncherTask() } if (wasInPiP) { navToLauncherTask() }
// if the player is in pip, remove the task, else we'll get a zombie
if (isInPiPMode()) { finishAndRemoveTask() }
} }
override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
@ -184,9 +186,7 @@ class PlayerActivity : AppCompatActivity() {
super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig) super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig)
// Hide the full-screen UI (controls, etc.) while in picture-in-picture mode. // Hide the full-screen UI (controls, etc.) while in picture-in-picture mode.
if (isInPictureInPictureMode) { video_view.useController = !isInPictureInPictureMode
controller.hideImmediately()
}
} }
private fun initPlayer() { private fun initPlayer() {
@ -199,8 +199,8 @@ class PlayerActivity : AppCompatActivity() {
initTimeUpdates() initTimeUpdates()
// if the player is ready or buffering we can simply play the file again, else do nothing // if the player is ready or buffering we can simply play the file again, else do nothing
if ((model.player.playbackState == ExoPlayer.STATE_READY || model.player.playbackState == ExoPlayer.STATE_BUFFERING) val playbackState = model.player.playbackState
) { if ((playbackState == ExoPlayer.STATE_READY || playbackState == ExoPlayer.STATE_BUFFERING)) {
model.player.play() model.player.play()
} }
} }