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 1a70db157c..437784ae8d 100644 --- a/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt @@ -166,7 +166,10 @@ object PlayerHelper { get() = watchPositionsPref in listOf("always", "videos") val watchPositionsAudio: Boolean - get() = watchPositionsPref == "always" + get() = watchPositionsPref in listOf("always", "audio") + + val watchPositionsAny: Boolean + get() = watchPositionsVideo || watchPositionsAudio val watchHistoryEnabled: Boolean get() = PreferenceHelper.getBoolean( diff --git a/app/src/main/java/com/github/libretube/services/AbstractPlayerService.kt b/app/src/main/java/com/github/libretube/services/AbstractPlayerService.kt index 3b22b80a2c..7f75dcb9d4 100644 --- a/app/src/main/java/com/github/libretube/services/AbstractPlayerService.kt +++ b/app/src/main/java/com/github/libretube/services/AbstractPlayerService.kt @@ -313,7 +313,10 @@ abstract class AbstractPlayerService : MediaLibraryService(), MediaLibrarySessio abstract suspend fun startPlayback() private fun saveWatchPosition() { - if (isTransitioning || !PlayerHelper.watchPositionsVideo) return + val watchPositionsEnabled = + (PlayerHelper.watchPositionsAudio && isAudioOnlyPlayer) || (PlayerHelper.watchPositionsVideo && !isAudioOnlyPlayer) + + if (isTransitioning || !watchPositionsEnabled) return exoPlayer?.let { PlayerHelper.saveWatchPosition(it, videoId) } } diff --git a/app/src/main/java/com/github/libretube/ui/sheets/VideoOptionsBottomSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/VideoOptionsBottomSheet.kt index 2b043e3868..f23dd1d94a 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/VideoOptionsBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/VideoOptionsBottomSheet.kt @@ -141,7 +141,7 @@ class VideoOptionsBottomSheet : BaseBottomSheet() { } // show the mark as watched or unwatched option if watch positions are enabled - if (PlayerHelper.watchPositionsVideo || PlayerHelper.watchHistoryEnabled) { + if (PlayerHelper.watchPositionsAny || PlayerHelper.watchHistoryEnabled) { val watchPositionEntry = runBlocking(Dispatchers.IO) { DatabaseHolder.Database.watchPositionDao().findById(videoId) } diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index 413f484b20..98aee920a3 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -439,12 +439,14 @@ @string/always @string/videos + @string/audio @string/never always videos + audio never