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