diff --git a/org.librarysimplified.audiobook.media3/src/main/java/org/librarysimplified/audiobook/media3/ExoAdapter.kt b/org.librarysimplified.audiobook.media3/src/main/java/org/librarysimplified/audiobook/media3/ExoAdapter.kt index 8d7280ef..a9fd647b 100644 --- a/org.librarysimplified.audiobook.media3/src/main/java/org/librarysimplified/audiobook/media3/ExoAdapter.kt +++ b/org.librarysimplified.audiobook.media3/src/main/java/org/librarysimplified/audiobook/media3/ExoAdapter.kt @@ -191,13 +191,18 @@ class ExoAdapter( ) { this.logger.debug("onPlayWhenReadyChanged: {} {})", playWhenReady, reason) - if (this.exoPlayer.isPlaying) { - this.newState(ExoPlayerPlaybackStatus.PLAYING) - } else { - if (this.exoPlayer.isLoading) { - this.isBufferingNow = true - this.newState(ExoPlayerPlaybackStatus.BUFFERING) - } else { + when (playWhenReady) { + true -> { + if (this.exoPlayer.isPlaying) { + this.newState(ExoPlayerPlaybackStatus.PLAYING) + return + } + if (this.exoPlayer.isLoading) { + this.isBufferingNow = true + this.newState(ExoPlayerPlaybackStatus.BUFFERING) + } + } + false -> { this.newState(ExoPlayerPlaybackStatus.PAUSED) } }