From f95f3d4637759545a662194d5a13b2cc84cdabef Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Sat, 21 Dec 2024 19:33:42 +0100 Subject: [PATCH] Fix music play action not working after queue has ended --- .../androidtv/ui/playback/rewrite/RewriteMediaManager.kt | 2 +- playback/media3/exoplayer/src/main/kotlin/ExoPlayerBackend.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/jellyfin/androidtv/ui/playback/rewrite/RewriteMediaManager.kt b/app/src/main/java/org/jellyfin/androidtv/ui/playback/rewrite/RewriteMediaManager.kt index 0b5cdac5aa..25f4912119 100644 --- a/app/src/main/java/org/jellyfin/androidtv/ui/playback/rewrite/RewriteMediaManager.kt +++ b/app/src/main/java/org/jellyfin/androidtv/ui/playback/rewrite/RewriteMediaManager.kt @@ -266,7 +266,7 @@ class RewriteMediaManager( override fun togglePlayPause() { val playState = playbackManager.state.playState.value - if (playState == PlayState.PAUSED) playbackManager.state.unpause() + if (playState == PlayState.PAUSED || playState == PlayState.STOPPED) playbackManager.state.unpause() else if (playState == PlayState.PLAYING) playbackManager.state.pause() } diff --git a/playback/media3/exoplayer/src/main/kotlin/ExoPlayerBackend.kt b/playback/media3/exoplayer/src/main/kotlin/ExoPlayerBackend.kt index 68b8f905e7..85cd218e4e 100644 --- a/playback/media3/exoplayer/src/main/kotlin/ExoPlayerBackend.kt +++ b/playback/media3/exoplayer/src/main/kotlin/ExoPlayerBackend.kt @@ -209,6 +209,8 @@ class ExoPlayerBackend( } override fun play() { + // If the item has ended, revert first so the item will start over again + if (exoPlayer.playbackState == Player.STATE_ENDED) exoPlayer.seekTo(0) exoPlayer.play() }