Skip to content

Commit

Permalink
Fix music play action not working after queue has ended
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Dec 21, 2024
1 parent 8b2d398 commit f95f3d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
2 changes: 2 additions & 0 deletions playback/media3/exoplayer/src/main/kotlin/ExoPlayerBackend.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit f95f3d4

Please sign in to comment.