Skip to content

Commit

Permalink
Merge pull request #2886 from praveenrajput/master
Browse files Browse the repository at this point in the history
Keep screen on only while video is playing #2877
  • Loading branch information
Bnyro committed Jan 29, 2023
2 parents d8cd1d4 + 275f304 commit 30d6920
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
})

Expand Down

0 comments on commit 30d6920

Please sign in to comment.