diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt index 4d39e14e2..189d9ec5d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt @@ -1270,18 +1270,17 @@ class PlayerActivity : "pause" -> { if (!isFinishing) { setAudioFocus(value) - - if (player.timePos != null && player.duration != null) { - animationHandler.removeCallbacks(nextEpisodeRunnable) - val isVideoEof = MPVLib.getPropertyBoolean("eof-reached") == true - val isVideoCompleted = isVideoEof || (player.timePos!! >= player.duration!!) - if (isVideoCompleted && preferences.autoplayEnabled().get()) { - animationHandler.postDelayed(nextEpisodeRunnable, 1000L) - } - } updatePlaybackStatus(value) } } + "eof-reached" -> endFile(value) + } + } + + private fun endFile(eofReached: Boolean) { + animationHandler.removeCallbacks(nextEpisodeRunnable) + if (eofReached && preferences.autoplayEnabled().get()) { + animationHandler.postDelayed(nextEpisodeRunnable, 1000L) } }