diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 05571bad2a..d303ecb533 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -4,6 +4,8 @@ * Match codecs starting with "mp4a" to different Audio MimeTypes ([#3779](https://github.com/google/ExoPlayer/issues/3779)). +* MediaSession extension: Omit fast forward and rewind actions when media is not + seekable ([#4001](https://github.com/google/ExoPlayer/issues/4001)). ### 2.7.1 ### diff --git a/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/DefaultPlaybackController.java b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/DefaultPlaybackController.java index 1eb3ffd13d..ce597b45cd 100644 --- a/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/DefaultPlaybackController.java +++ b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/DefaultPlaybackController.java @@ -77,11 +77,10 @@ public class DefaultPlaybackController implements MediaSessionConnector.Playback public long getSupportedPlaybackActions(Player player) { if (player == null || player.getCurrentTimeline().isEmpty()) { return 0; + } else if (!player.isCurrentWindowSeekable()) { + return BASE_ACTIONS; } - long actions = BASE_ACTIONS; - if (player.isCurrentWindowSeekable()) { - actions |= PlaybackStateCompat.ACTION_SEEK_TO; - } + long actions = BASE_ACTIONS | PlaybackStateCompat.ACTION_SEEK_TO; if (fastForwardIncrementMs > 0) { actions |= PlaybackStateCompat.ACTION_FAST_FORWARD; }