Merge pull request #7367 from inv3rse:keep-paused-state-during-buffering

PiperOrigin-RevId: 311623784
This commit is contained in:
Oliver Woodman 2020-05-15 10:58:46 +01:00
commit 932a8fcf3d
2 changed files with 6 additions and 1 deletions

View File

@ -199,6 +199,9 @@
Services rather than Cronet Embedded. This allows Cronet to be used with a
negligible increase in application size, compared to approximately 8MB when
embedding the library.
* MediaSession extension: Set session playback state to BUFFERING only when
actually playing ([#7367](https://github.com/google/ExoPlayer/pull/7367),
[#7206](https://github.com/google/ExoPlayer/issues/7206)).
### 2.11.4 (2020-04-08)

View File

@ -946,7 +946,9 @@ public final class MediaSessionConnector {
@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: