Merge pull request #6593 from Relwi/refactor/next-video-with-autoplay-off

refactor: click on video playlist won't load if autoplay is off
This commit is contained in:
Bnyro 2024-10-05 13:45:29 +02:00 committed by GitHub
commit ad1be01fcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -970,7 +970,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
(videoStream?.height ?: 0) > (videoStream?.width ?: 0)
PlayingQueue.setOnQueueTapListener { streamItem ->
streamItem.url?.toID()?.let { playNextVideo(it, true) }
streamItem.url?.toID()?.let { playNextVideo(it) }
}
// hide the button to skip SponsorBlock segments manually
@ -1042,13 +1042,13 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
/**
* Can be used for autoplay and manually skipping to the next video.
*/
private fun playNextVideo(nextId: String? = null, isOnQueueClick: Boolean = false) {
private fun playNextVideo(nextId: String? = null) {
if (nextId == null && PlayingQueue.repeatMode == Player.REPEAT_MODE_ONE) {
viewModel.player.seekTo(0)
return
}
if (!PlayerHelper.isAutoPlayEnabled(playlistId != null) && !isOnQueueClick) return
if (!PlayerHelper.isAutoPlayEnabled(playlistId != null) && nextId == null) return
// save the current watch position before starting the next video
saveWatchPosition()