diff --git a/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt b/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt index 8ab1ab45b..77d98dfd4 100644 --- a/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt @@ -41,6 +41,7 @@ import com.github.libretube.enums.PlayerEvent import com.github.libretube.enums.SbSkipOptions import com.github.libretube.extensions.updateParameters import com.github.libretube.obj.VideoStats +import com.github.libretube.util.PlayingQueue import com.github.libretube.util.TextUtils import java.util.Locale import java.util.concurrent.Executors @@ -343,6 +344,11 @@ object PlayerHelper { ) fun shouldPlayNextVideo(isPlaylist: Boolean = false): Boolean { + // if there is no next video, it obviously should not be played + if (!PlayingQueue.hasNext()) { + return false + } + return autoPlayEnabled || ( isPlaylist && PreferenceHelper.getBoolean( PreferenceKeys.AUTOPLAY_PLAYLISTS, diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt index 3ded1b1b6..8157198d4 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt @@ -113,11 +113,11 @@ import com.github.libretube.util.PlayingQueue import com.github.libretube.util.TextUtils import com.github.libretube.util.TextUtils.toTimeInSeconds import com.github.libretube.util.YoutubeHlsPlaylistParser -import java.util.concurrent.Executors -import kotlin.math.abs import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import java.util.concurrent.Executors +import kotlin.math.abs @androidx.annotation.OptIn(androidx.media3.common.util.UnstableApi::class) class PlayerFragment : Fragment(), OnlinePlayerOptions { @@ -313,7 +313,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions { playNextVideo() } } else { - binding.player.showController() + binding.player.showControllerPermanently() } } diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index a4a289944..8c90a2f56 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -269,6 +269,12 @@ open class CustomExoPlayerView( super.showController() } + fun showControllerPermanently() { + // remove the previous callback from the queue to prevent a flashing behavior + cancelHideControllerTask() + super.showController() + } + override fun onTouchEvent(event: MotionEvent) = false private fun initRewindAndForward() {