mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 07:50:31 +05:30
fix: preference to only store watch positions for video doesn't work
This commit is contained in:
parent
bbe81ea053
commit
6a8de0dc6d
@ -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(
|
||||
|
@ -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) }
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -439,12 +439,14 @@
|
||||
<string-array name="watchPosition">
|
||||
<item>@string/always</item>
|
||||
<item>@string/videos</item>
|
||||
<item>@string/audio</item>
|
||||
<item>@string/never</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="watchPositionValues">
|
||||
<item>always</item>
|
||||
<item>videos</item>
|
||||
<item>audio</item>
|
||||
<item>never</item>
|
||||
</string-array>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user