From 5fd21c83937faecc6ac3ecede262ab8ef4fa973d Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Sun, 2 Feb 2025 13:00:28 -0700 Subject: [PATCH] Change: sleep timer EoC cutoff to be 10 seconds --- .../com/audiobookshelf/app/managers/SleepTimerManager.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt index ddf4aa4b..98fbff47 100644 --- a/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt +++ b/android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt @@ -276,8 +276,11 @@ constructor(private val playerNotificationService: PlayerNotificationService) { } val timeLeftInChapter = currentChapterEndTimeMs - getCurrentTime() - return if (timeLeftInChapter < 2000L) { - Log.i(tag, "Getting chapter sleep timer time and current chapter has less than 2s remaining") + // If less than 10 seconds remain in the chapter, set the timer to the next chapter or track + // This handles the auto-rewind from not playing media for a little bit to select the next + // chapter + return if (timeLeftInChapter < 10000L) { + Log.i(tag, "Getting chapter sleep timer time and current chapter has less than 10s remaining") val nextChapterEndTimeMs = playerNotificationService.getEndTimeOfNextChapterOrTrack() if (nextChapterEndTimeMs == null || currentChapterEndTimeMs == nextChapterEndTimeMs) { Log.e(