Merge pull request #2886 from praveenrajput/master

Keep screen on only while video is playing #2877
This commit is contained in:
Bnyro 2023-01-29 08:30:46 +01:00 committed by GitHub
commit 30d6920fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -172,16 +172,10 @@ internal class CustomExoPlayerView(
)
) {
updatePlayPauseButton()
}
}
override fun onPlaybackStateChanged(playbackState: Int) {
// keep the screen on if the video is not ended or paused
keepScreenOn = !(
listOf(Player.STATE_IDLE, Player.STATE_ENDED)
.contains(playbackState)
)
super.onPlaybackStateChanged(playbackState)
// keep screen on if the video is playing
keepScreenOn = player.isPlaying == true
}
}
})