ControlDispatcher
public class DefaultControlDispatcher extends Object implements ControlDispatcher
ControlDispatcher
.Modifier and Type | Field | 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.
|
Constructor | Description |
---|---|
DefaultControlDispatcher() |
Creates an instance.
|
DefaultControlDispatcher(long fastForwardIncrementMs,
long rewindIncrementMs) |
Creates an instance with the given increments.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
dispatchFastForward(Player player) |
Dispatches a fast forward operation.
|
boolean |
dispatchNext(Player player) |
Dispatches a
Player.next() operation. |
boolean |
dispatchPrepare(Player player) |
Dispatches a
Player.prepare() operation. |
boolean |
dispatchPrevious(Player player) |
Dispatches a
Player.previous() operation. |
boolean |
dispatchRewind(Player player) |
Dispatches a rewind operation.
|
boolean |
dispatchSeekTo(Player player,
int windowIndex,
long positionMs) |
Dispatches a
Player.seekTo(int, long) operation. |
boolean |
dispatchSetPlaybackParameters(Player player,
PlaybackParameters playbackParameters) |
Dispatches a
Player.setPlaybackParameters(PlaybackParameters) operation. |
boolean |
dispatchSetPlayWhenReady(Player player,
boolean playWhenReady) |
Dispatches a
Player.setPlayWhenReady(boolean) operation. |
boolean |
dispatchSetRepeatMode(Player player,
int repeatMode) |
Dispatches a
Player.setRepeatMode(int) operation. |
boolean |
dispatchSetShuffleModeEnabled(Player player,
boolean shuffleModeEnabled) |
Dispatches a
Player.setShuffleModeEnabled(boolean) operation. |
boolean |
dispatchStop(Player player,
boolean reset) |
Dispatches a
Player.stop() operation. |
long |
getFastForwardIncrementMs() |
Returns the fast forward increment in milliseconds.
|
long |
getRewindIncrementMs() |
Returns the rewind increment in milliseconds.
|
boolean |
isFastForwardEnabled() |
Returns
true if fast forward is enabled, false otherwise. |
boolean |
isRewindEnabled() |
Returns
true if rewind is enabled, false otherwise. |
void |
setFastForwardIncrementMs(long fastForwardMs) |
Deprecated.
Create a new instance instead and pass the new instance to the UI component.
|
void |
setRewindIncrementMs(long rewindMs) |
Deprecated.
Create a new instance instead and pass the new instance to the UI component.
|
public static final int DEFAULT_FAST_FORWARD_MS
public static final int DEFAULT_REWIND_MS
public DefaultControlDispatcher()
public DefaultControlDispatcher(long fastForwardIncrementMs, long rewindIncrementMs)
fastForwardIncrementMs
- The fast forward increment in milliseconds. A non-positive value
disables the fast forward operation.rewindIncrementMs
- The rewind increment in milliseconds. A non-positive value disables
the rewind operation.public boolean dispatchPrepare(Player player)
ControlDispatcher
Player.prepare()
operation.dispatchPrepare
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.public boolean dispatchSetPlayWhenReady(Player player, boolean playWhenReady)
ControlDispatcher
Player.setPlayWhenReady(boolean)
operation.dispatchSetPlayWhenReady
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.playWhenReady
- Whether playback should proceed when ready.public boolean dispatchSeekTo(Player player, int windowIndex, long positionMs)
ControlDispatcher
Player.seekTo(int, long)
operation.dispatchSeekTo
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.windowIndex
- The index of the window.positionMs
- The seek position in the specified window, or C.TIME_UNSET
to seek to
the window's default position.public boolean dispatchPrevious(Player player)
ControlDispatcher
Player.previous()
operation.dispatchPrevious
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.public boolean dispatchNext(Player player)
ControlDispatcher
Player.next()
operation.dispatchNext
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.public boolean dispatchRewind(Player player)
ControlDispatcher
dispatchRewind
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.public boolean dispatchFastForward(Player player)
ControlDispatcher
dispatchFastForward
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.public boolean dispatchSetRepeatMode(Player player, @RepeatMode int repeatMode)
ControlDispatcher
Player.setRepeatMode(int)
operation.dispatchSetRepeatMode
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.repeatMode
- The repeat mode.public boolean dispatchSetShuffleModeEnabled(Player player, boolean shuffleModeEnabled)
ControlDispatcher
Player.setShuffleModeEnabled(boolean)
operation.dispatchSetShuffleModeEnabled
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.shuffleModeEnabled
- Whether shuffling is enabled.public boolean dispatchStop(Player player, boolean reset)
ControlDispatcher
Player.stop()
operation.dispatchStop
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.reset
- Whether the player should be reset.public boolean dispatchSetPlaybackParameters(Player player, PlaybackParameters playbackParameters)
ControlDispatcher
Player.setPlaybackParameters(PlaybackParameters)
operation.dispatchSetPlaybackParameters
in interface ControlDispatcher
player
- The Player
to which the operation should be dispatched.playbackParameters
- The playback parameters.public boolean isRewindEnabled()
ControlDispatcher
true
if rewind is enabled, false
otherwise.isRewindEnabled
in interface ControlDispatcher
public boolean isFastForwardEnabled()
ControlDispatcher
true
if fast forward is enabled, false
otherwise.isFastForwardEnabled
in interface ControlDispatcher
public long getRewindIncrementMs()
public long getFastForwardIncrementMs()
@Deprecated public void setRewindIncrementMs(long rewindMs)
@Deprecated public void setFastForwardIncrementMs(long fastForwardMs)