mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Keep the screen on while playing in the offline player
This commit is contained in:
parent
f119e39a1e
commit
ff6a0f1138
@ -167,7 +167,7 @@ class MainActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
R.id.searchResultFragment -> {
|
R.id.searchResultFragment -> {
|
||||||
navController.popBackStack(R.id.searchFragment, true) ||
|
navController.popBackStack(R.id.searchFragment, true) ||
|
||||||
navController.popBackStack()
|
navController.popBackStack()
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
navController.popBackStack()
|
navController.popBackStack()
|
||||||
|
@ -919,11 +919,6 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onPlaybackStateChanged(playbackState: Int) {
|
override fun onPlaybackStateChanged(playbackState: Int) {
|
||||||
exoPlayerView.keepScreenOn = !(
|
|
||||||
playbackState == Player.STATE_IDLE ||
|
|
||||||
playbackState == Player.STATE_ENDED
|
|
||||||
)
|
|
||||||
|
|
||||||
// save the watch position to the database
|
// save the watch position to the database
|
||||||
// only called when the position is unequal to 0, otherwise it would become reset
|
// only called when the position is unequal to 0, otherwise it would become reset
|
||||||
// before the player can seek to the saved position from videos of the queue
|
// before the player can seek to the saved position from videos of the queue
|
||||||
|
@ -177,6 +177,15 @@ internal class CustomExoPlayerView(
|
|||||||
updatePlayPauseButton()
|
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)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
playerViewModel?.isFullscreen?.observe(viewLifecycleOwner!!) { isFullscreen ->
|
playerViewModel?.isFullscreen?.observe(viewLifecycleOwner!!) { isFullscreen ->
|
||||||
|
Loading…
Reference in New Issue
Block a user