mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
commit
966405e922
@ -1100,18 +1100,14 @@ class PlayerFragment : BaseFragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(message = "Deprecated", level = DeprecationLevel.HIDDEN)
|
override fun onPlaybackStateChanged(playbackState: Int) {
|
||||||
override fun onPlayerStateChanged(
|
|
||||||
playWhenReady: Boolean,
|
|
||||||
playbackState: Int
|
|
||||||
) {
|
|
||||||
exoPlayerView.keepScreenOn = !(
|
exoPlayerView.keepScreenOn = !(
|
||||||
playbackState == Player.STATE_IDLE ||
|
playbackState == Player.STATE_IDLE ||
|
||||||
playbackState == Player.STATE_ENDED ||
|
playbackState == Player.STATE_ENDED
|
||||||
!playWhenReady
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// check if video has ended, next video is available and autoplay is enabled.
|
// check if video has ended, next video is available and autoplay is enabled.
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
if (
|
if (
|
||||||
playbackState == Player.STATE_ENDED &&
|
playbackState == Player.STATE_ENDED &&
|
||||||
nextStreamId != null &&
|
nextStreamId != null &&
|
||||||
@ -1123,19 +1119,21 @@ class PlayerFragment : BaseFragment() {
|
|||||||
if (autoplayEnabled) playNextVideo()
|
if (autoplayEnabled) playNextVideo()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playWhenReady && playbackState == Player.STATE_READY) {
|
if (playbackState == Player.STATE_READY) {
|
||||||
// media actually playing
|
// media actually playing
|
||||||
transitioning = false
|
transitioning = false
|
||||||
binding.playImageView.setImageResource(R.drawable.ic_pause)
|
binding.playImageView.setImageResource(R.drawable.ic_pause)
|
||||||
} else if (playWhenReady) {
|
|
||||||
// might be idle (plays after prepare()),
|
|
||||||
// buffering (plays when data available)
|
|
||||||
// or ended (plays when seek away from end)
|
|
||||||
binding.playImageView.setImageResource(R.drawable.ic_play)
|
|
||||||
} else {
|
} else {
|
||||||
// player paused in any state
|
// player paused in any state
|
||||||
binding.playImageView.setImageResource(R.drawable.ic_play)
|
binding.playImageView.setImageResource(R.drawable.ic_play)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// listen for the stop button in the notification
|
||||||
|
if (playbackState == PlaybackState.STATE_STOPPED) {
|
||||||
|
// finish PiP by finishing the activity
|
||||||
|
activity?.finish()
|
||||||
|
}
|
||||||
|
super.onPlaybackStateChanged(playbackState)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1191,6 +1189,7 @@ class PlayerFragment : BaseFragment() {
|
|||||||
Html.fromHtml(description, Html.FROM_HTML_MODE_COMPACT)
|
Html.fromHtml(description, Html.FROM_HTML_MODE_COMPACT)
|
||||||
.trim()
|
.trim()
|
||||||
} else {
|
} else {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
Html.fromHtml(description).trim()
|
Html.fromHtml(description).trim()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user