Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions app/src/main/kotlin/xyz/mpv/rex/ui/player/PlayerActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Loading