Skip to content

Commit

Permalink
Keep the paused state during buffering without playWhenReady.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
inv3rse committed May 12, 2020
1 parent 535e14c commit 8d2406e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8d2406e

Please sign in to comment.