diff --git a/app/src/main/kotlin/xyz/mpv/rex/ui/player/PlayerActivity.kt b/app/src/main/kotlin/xyz/mpv/rex/ui/player/PlayerActivity.kt index 79c9644c8..19665660c 100644 --- a/app/src/main/kotlin/xyz/mpv/rex/ui/player/PlayerActivity.kt +++ b/app/src/main/kotlin/xyz/mpv/rex/ui/player/PlayerActivity.kt @@ -323,15 +323,15 @@ class PlayerActivity : webSubtitlesJob = null if (!isQualitySwitching) { - if ( - isAutoplayNextTriggered || - !playerPreferences.autoplayOnOpen.get() || - playerPreferences.showControlsOnPlay.get() - ) { - viewModel.showControls() - } else { - viewModel.hideControls() - } + if ( + playerPreferences.showControlsOnPlay.get() || + (!isAutoAdvancing && + (isAutoplayNextTriggered || !playerPreferences.autoplayOnOpen.get())) + ) { + viewModel.showControls() + } else { + viewModel.hideControls() + } playbackStateLoadJob?.cancel() activePlaybackLoadState = pendingPlaybackLoadStates.poll() @@ -354,6 +354,7 @@ class PlayerActivity : override fun onFileLoaded() { Log.d(TAG, "onFileLoaded called") lastFileLoadedTimeMs = SystemClock.elapsedRealtime() + val wasAutoAdvancing = isAutoAdvancing isAutoAdvancing = false val preparedState = if (isQualitySwitching) { null @@ -364,7 +365,7 @@ class PlayerActivity : Log.d(TAG, "Ignoring stale FILE_LOADED restoration for generation ${preparedState.generation}") return } - handleFileLoaded(preparedState) + handleFileLoaded(preparedState, wasAutoAdvancing) isReady = true val subs = pendingWebSubtitles @@ -2009,7 +2010,7 @@ class PlayerActivity : * Initializes playback state, loads saved playback data, restores custom settings, * applies user preferences, and sets up metadata and media session. */ - private fun handleFileLoaded(preparedState: PlayerPlaybackStateController.PreparedPlaybackState? = null) { + private fun handleFileLoaded(preparedState: PlayerPlaybackStateController.PreparedPlaybackState? = null, wasAutoAdvancing: Boolean = false) { if (isQualitySwitching) { isQualitySwitching = false val loadedDurationSec = MPVLib.getPropertyDouble("duration") ?: 0.0 @@ -2081,7 +2082,7 @@ class PlayerActivity : val loadedMediaTitle = fileName val loadGeneration = preparedState?.generation ?: playbackLoadGeneration.get() val isPlaylistNavigation = isAutoplayNextTriggered - val shouldAutoplay = playerPreferences.autoplayOnOpen.get() || isAutoplayNextTriggered + val shouldAutoplay = playerPreferences.autoplayOnOpen.get() || wasAutoAdvancing isAutoplayNextTriggered = false isAutoAdvancing = false