From c0dac7cba0a0dd0272a0b4c00f4f96440774e87f Mon Sep 17 00:00:00 2001
From: FineFindus <FineFindus@proton.me>
Date: Tue, 26 Mar 2024 20:28:57 +0100
Subject: [PATCH] feat(player): display controller if there is no next video

---
 .../main/java/com/github/libretube/helpers/PlayerHelper.kt    | 4 ++++
 1 file changed, 4 insertions(+)

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..1bddbec8a 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,9 @@ object PlayerHelper {
             )
 
     fun shouldPlayNextVideo(isPlaylist: Boolean = false): Boolean {
+        // if there is no next video, it obviously should not be played
+        if (PlayingQueue.getNext() == null)
+            return false
         return autoPlayEnabled || (
             isPlaylist && PreferenceHelper.getBoolean(
                 PreferenceKeys.AUTOPLAY_PLAYLISTS,