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.
This commit is contained in:
Dennis Fölster 2020-05-12 14:43:47 +02:00
parent 535e14cb4d
commit 8d2406ece3

View File

@ -946,7 +946,9 @@ public final class MediaSessionConnector {
@Player.State int exoPlayerPlaybackState, boolean playWhenReady) { @Player.State int exoPlayerPlaybackState, boolean playWhenReady) {
switch (exoPlayerPlaybackState) { switch (exoPlayerPlaybackState) {
case Player.STATE_BUFFERING: case Player.STATE_BUFFERING:
return PlaybackStateCompat.STATE_BUFFERING; return playWhenReady
? PlaybackStateCompat.STATE_BUFFERING
: PlaybackStateCompat.STATE_PAUSED;
case Player.STATE_READY: case Player.STATE_READY:
return playWhenReady ? PlaybackStateCompat.STATE_PLAYING : PlaybackStateCompat.STATE_PAUSED; return playWhenReady ? PlaybackStateCompat.STATE_PLAYING : PlaybackStateCompat.STATE_PAUSED;
case Player.STATE_ENDED: case Player.STATE_ENDED: