This commit is contained in:
Mariotaku Lee 2017-06-04 17:34:26 +08:00
parent 4ef27bfd58
commit 9f4d4fed13
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
1 changed files with 4 additions and 0 deletions

View File

@ -117,11 +117,13 @@ class ExoPlayerPageFragment : MediaViewerFragment(), IBaseFragment<ExoPlayerPage
override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) {
when (playbackState) {
ExoPlayer.STATE_BUFFERING -> {
playerView.keepScreenOn = true
showProgress(true, 0f)
}
ExoPlayer.STATE_ENDED -> {
playbackCompleted = true
positionBackup = -1L
playerView.keepScreenOn = false
// Reset position
playerView.player?.let { player ->
@ -136,9 +138,11 @@ class ExoPlayerPageFragment : MediaViewerFragment(), IBaseFragment<ExoPlayerPage
ExoPlayer.STATE_READY -> {
playbackCompleted = playWhenReady
playerHasError = false
playerView.keepScreenOn = playWhenReady
hideProgress()
}
ExoPlayer.STATE_IDLE -> {
playerView.keepScreenOn = false
hideProgress()
}
}