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
This commit is contained in:
bachinger 2018-03-20 04:31:36 -07:00 committed by Oliver Woodman
parent 5ce0c6fead
commit b04ec2190b
2 changed files with 5 additions and 4 deletions

View File

@ -4,6 +4,8 @@
* Match codecs starting with "mp4a" to different Audio MimeTypes * Match codecs starting with "mp4a" to different Audio MimeTypes
([#3779](https://github.com/google/ExoPlayer/issues/3779)). ([#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 ### ### 2.7.1 ###

View File

@ -77,11 +77,10 @@ public class DefaultPlaybackController implements MediaSessionConnector.Playback
public long getSupportedPlaybackActions(Player player) { public long getSupportedPlaybackActions(Player player) {
if (player == null || player.getCurrentTimeline().isEmpty()) { if (player == null || player.getCurrentTimeline().isEmpty()) {
return 0; return 0;
} else if (!player.isCurrentWindowSeekable()) {
return BASE_ACTIONS;
} }
long actions = BASE_ACTIONS; long actions = BASE_ACTIONS | PlaybackStateCompat.ACTION_SEEK_TO;
if (player.isCurrentWindowSeekable()) {
actions |= PlaybackStateCompat.ACTION_SEEK_TO;
}
if (fastForwardIncrementMs > 0) { if (fastForwardIncrementMs > 0) {
actions |= PlaybackStateCompat.ACTION_FAST_FORWARD; actions |= PlaybackStateCompat.ACTION_FAST_FORWARD;
} }