From 8d2406ece36c35875277256822ea5908b7d6050b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20F=C3=B6lster?= <3sr3vn1@gmail.com> Date: Tue, 12 May 2020 14:43:47 +0200 Subject: [PATCH] Keep the paused state during buffering without playWhenReady. The PlaybackStateCompat#STATE_BUFFERING expects the playback to begin once enough data has been buffered. This is however not the case if playWhenReady is not set on the exoplayer. --- .../exoplayer2/ext/mediasession/MediaSessionConnector.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java index fc75d4f5498..b74ad9701f7 100644 --- a/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java +++ b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java @@ -946,7 +946,9 @@ private static int getMediaSessionPlaybackState( @Player.State int exoPlayerPlaybackState, boolean playWhenReady) { switch (exoPlayerPlaybackState) { case Player.STATE_BUFFERING: - return PlaybackStateCompat.STATE_BUFFERING; + return playWhenReady + ? PlaybackStateCompat.STATE_BUFFERING + : PlaybackStateCompat.STATE_PAUSED; case Player.STATE_READY: return playWhenReady ? PlaybackStateCompat.STATE_PLAYING : PlaybackStateCompat.STATE_PAUSED; case Player.STATE_ENDED: