Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: click on video playlist won't load if autoplay is off #6588

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
(videoStream?.height ?: 0) > (videoStream?.width ?: 0)

PlayingQueue.setOnQueueTapListener { streamItem ->
streamItem.url?.toID()?.let { playNextVideo(it) }
streamItem.url?.toID()?.let { playNextVideo(it, true) }
}

// hide the button to skip SponsorBlock segments manually
Expand Down Expand Up @@ -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) {
private fun playNextVideo(nextId: String? = null, isOnQueueClick: Boolean = false) {
if (nextId == null && PlayingQueue.repeatMode == Player.REPEAT_MODE_ONE) {
viewModel.player.seekTo(0)
return
}

if (!PlayerHelper.isAutoPlayEnabled(playlistId != null)) return
if (!PlayerHelper.isAutoPlayEnabled(playlistId != null) && !isOnQueueClick) return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we instead do !PlayerHelper.isAutoPlayEnabled(playlistId != null) && nextId == null, since in theory autoplay will never call this function with any video id provided (if I remember correctly how I intended to write that code) whereas the nextId is set when tapping a video in the queue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same applies for your other PR, I probably merged that too quickly before thinking)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, it worked in that way too, I opened another PR


// save the current watch position before starting the next video
saveWatchPosition()
Expand Down
Loading