From b04ec2190b80b0096653ce2fc8865b63d1ba2671 Mon Sep 17 00:00:00 2001 From: bachinger Date: Tue, 20 Mar 2018 04:31:36 -0700 Subject: [PATCH] Omit fast forward and rewind actions when current window is not seekable Issue: #4001 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=189722812 --- RELEASENOTES.md | 2 ++ .../ext/mediasession/DefaultPlaybackController.java | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) 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; }