public class DefaultPlaybackController extends java.lang.Object implements MediaSessionConnector.PlaybackController
MediaSessionConnector.PlaybackController.
Methods can be safely overridden by subclasses to intercept calls for given actions.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_FAST_FORWARD_MS
The default fast forward increment, in milliseconds.
|
static int |
DEFAULT_REWIND_MS
The default rewind increment, in milliseconds.
|
protected long |
fastForwardIncrementMs |
protected int |
repeatToggleModes |
protected long |
rewindIncrementMs |
ACTIONS| Constructor and Description |
|---|
DefaultPlaybackController()
Creates a new instance.
|
DefaultPlaybackController(long rewindIncrementMs,
long fastForwardIncrementMs,
int repeatToggleModes)
Creates a new instance with the given fast forward and rewind increments.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String[] |
getCommands()
Returns the commands the receiver handles, or
null if no commands need to be handled. |
long |
getSupportedPlaybackActions(com.google.android.exoplayer2.Player player)
Returns the actions which are supported by the controller.
|
void |
onCommand(com.google.android.exoplayer2.Player player,
java.lang.String command,
android.os.Bundle extras,
android.os.ResultReceiver cb)
See
MediaSessionCompat.Callback#onCommand(String, Bundle, ResultReceiver). |
void |
onFastForward(com.google.android.exoplayer2.Player player)
See
MediaSessionCompat.Callback#onFastForward(). |
void |
onPause(com.google.android.exoplayer2.Player player)
See
MediaSessionCompat.Callback#onPause(). |
void |
onPlay(com.google.android.exoplayer2.Player player)
See
MediaSessionCompat.Callback#onPlay(). |
void |
onRewind(com.google.android.exoplayer2.Player player)
See
MediaSessionCompat.Callback#onRewind(). |
void |
onSeekTo(com.google.android.exoplayer2.Player player,
long position)
See
MediaSessionCompat.Callback#onSeekTo(long). |
void |
onSetRepeatMode(com.google.android.exoplayer2.Player player,
int repeatMode)
See
MediaSessionCompat.Callback#onSetRepeatMode(int). |
void |
onSetShuffleMode(com.google.android.exoplayer2.Player player,
int shuffleMode)
See
MediaSessionCompat.Callback#onSetShuffleMode(int). |
void |
onStop(com.google.android.exoplayer2.Player player)
See
MediaSessionCompat.Callback#onStop(). |
public static final int DEFAULT_FAST_FORWARD_MS
public static final int DEFAULT_REWIND_MS
protected final long rewindIncrementMs
protected final long fastForwardIncrementMs
protected final int repeatToggleModes
public DefaultPlaybackController()
Equivalent to DefaultPlaybackController(DefaultPlaybackController.DEFAULT_REWIND_MS,
DefaultPlaybackController.DEFAULT_FAST_FORWARD_MS,
MediaSessionConnector.DEFAULT_REPEAT_TOGGLE_MODES).
public DefaultPlaybackController(long rewindIncrementMs,
long fastForwardIncrementMs,
@RepeatModeUtil.RepeatToggleModes
int repeatToggleModes)
rewindIncrementMs - The rewind increment in milliseconds. A zero or negative value will
cause the rewind action to be disabled.fastForwardIncrementMs - The fast forward increment in milliseconds. A zero or negativerepeatToggleModes - The available repeatToggleModes.public long getSupportedPlaybackActions(com.google.android.exoplayer2.Player player)
MediaSessionConnector.PlaybackControllerPlaybackStateCompat.ACTION_PLAY_PAUSE, PlaybackStateCompat.ACTION_PLAY, PlaybackStateCompat.ACTION_PAUSE, PlaybackStateCompat.ACTION_SEEK_TO, PlaybackStateCompat.ACTION_FAST_FORWARD, PlaybackStateCompat.ACTION_REWIND, PlaybackStateCompat.ACTION_STOP, PlaybackStateCompat.ACTION_SET_REPEAT_MODE and PlaybackStateCompat.ACTION_SET_SHUFFLE_MODE.getSupportedPlaybackActions in interface MediaSessionConnector.PlaybackControllerplayer - The player.public void onPlay(com.google.android.exoplayer2.Player player)
MediaSessionConnector.PlaybackControllerMediaSessionCompat.Callback#onPlay().onPlay in interface MediaSessionConnector.PlaybackControllerpublic void onPause(com.google.android.exoplayer2.Player player)
MediaSessionConnector.PlaybackControllerMediaSessionCompat.Callback#onPause().onPause in interface MediaSessionConnector.PlaybackControllerpublic void onSeekTo(com.google.android.exoplayer2.Player player,
long position)
MediaSessionConnector.PlaybackControllerMediaSessionCompat.Callback#onSeekTo(long).onSeekTo in interface MediaSessionConnector.PlaybackControllerpublic void onFastForward(com.google.android.exoplayer2.Player player)
MediaSessionConnector.PlaybackControllerMediaSessionCompat.Callback#onFastForward().onFastForward in interface MediaSessionConnector.PlaybackControllerpublic void onRewind(com.google.android.exoplayer2.Player player)
MediaSessionConnector.PlaybackControllerMediaSessionCompat.Callback#onRewind().onRewind in interface MediaSessionConnector.PlaybackControllerpublic void onStop(com.google.android.exoplayer2.Player player)
MediaSessionConnector.PlaybackControllerMediaSessionCompat.Callback#onStop().onStop in interface MediaSessionConnector.PlaybackControllerpublic void onSetShuffleMode(com.google.android.exoplayer2.Player player,
int shuffleMode)
MediaSessionConnector.PlaybackControllerMediaSessionCompat.Callback#onSetShuffleMode(int).onSetShuffleMode in interface MediaSessionConnector.PlaybackControllerpublic void onSetRepeatMode(com.google.android.exoplayer2.Player player,
int repeatMode)
MediaSessionConnector.PlaybackControllerMediaSessionCompat.Callback#onSetRepeatMode(int).onSetRepeatMode in interface MediaSessionConnector.PlaybackControllerpublic java.lang.String[] getCommands()
MediaSessionConnector.CommandReceivernull if no commands need to be handled.getCommands in interface MediaSessionConnector.CommandReceiverpublic void onCommand(com.google.android.exoplayer2.Player player,
java.lang.String command,
android.os.Bundle extras,
android.os.ResultReceiver cb)
MediaSessionConnector.CommandReceiverMediaSessionCompat.Callback#onCommand(String, Bundle, ResultReceiver).onCommand in interface MediaSessionConnector.CommandReceiver