Package com.google.android.exoplayer2
Class DefaultControlDispatcher
- java.lang.Object
-
- com.google.android.exoplayer2.DefaultControlDispatcher
-
- All Implemented Interfaces:
ControlDispatcher
public class DefaultControlDispatcher extends Object implements ControlDispatcher
DefaultControlDispatcher
.
-
-
Field Summary
Fields 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 Summary
Constructors Constructor Description DefaultControlDispatcher()
Creates an instance.DefaultControlDispatcher(long fastForwardIncrementMs, long rewindIncrementMs)
Creates an instance with the given increments.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
dispatchFastForward(Player player)
Dispatches a fast forward operation.boolean
dispatchNext(Player player)
Dispatches aPlayer.next()
operation.boolean
dispatchPrepare(Player player)
Dispatches aPlayer.prepare()
operation.boolean
dispatchPrevious(Player player)
Dispatches aPlayer.previous()
operation.boolean
dispatchRewind(Player player)
Dispatches a rewind operation.boolean
dispatchSeekTo(Player player, int windowIndex, long positionMs)
Dispatches aPlayer.seekTo(int, long)
operation.boolean
dispatchSetPlaybackParameters(Player player, PlaybackParameters playbackParameters)
Dispatches aPlayer.setPlaybackParameters(PlaybackParameters)
operation.boolean
dispatchSetPlayWhenReady(Player player, boolean playWhenReady)
Dispatches aPlayer.setPlayWhenReady(boolean)
operation.boolean
dispatchSetRepeatMode(Player player, int repeatMode)
Dispatches aPlayer.setRepeatMode(int)
operation.boolean
dispatchSetShuffleModeEnabled(Player player, boolean shuffleModeEnabled)
Dispatches aPlayer.setShuffleModeEnabled(boolean)
operation.boolean
dispatchStop(Player player, boolean reset)
Dispatches aPlayer.stop()
operation.long
getFastForwardIncrementMs()
Returns the fast forward increment in milliseconds.long
getRewindIncrementMs()
Returns the rewind increment in milliseconds.boolean
isFastForwardEnabled()
Returnstrue
if fast forward is enabled,false
otherwise.boolean
isRewindEnabled()
Returnstrue
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.
-
-
-
Field Detail
-
DEFAULT_FAST_FORWARD_MS
public static final int DEFAULT_FAST_FORWARD_MS
The default fast forward increment, in milliseconds.- See Also:
- Constant Field Values
-
DEFAULT_REWIND_MS
public static final int DEFAULT_REWIND_MS
The default rewind increment, in milliseconds.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultControlDispatcher
public DefaultControlDispatcher()
Creates an instance.
-
DefaultControlDispatcher
public DefaultControlDispatcher(long fastForwardIncrementMs, long rewindIncrementMs)
Creates an instance with the given increments.- Parameters:
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.
-
-
Method Detail
-
dispatchPrepare
public boolean dispatchPrepare(Player player)
Description copied from interface:ControlDispatcher
Dispatches aPlayer.prepare()
operation.- Specified by:
dispatchPrepare
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchSetPlayWhenReady
public boolean dispatchSetPlayWhenReady(Player player, boolean playWhenReady)
Description copied from interface:ControlDispatcher
Dispatches aPlayer.setPlayWhenReady(boolean)
operation.- Specified by:
dispatchSetPlayWhenReady
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.playWhenReady
- Whether playback should proceed when ready.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchSeekTo
public boolean dispatchSeekTo(Player player, int windowIndex, long positionMs)
Description copied from interface:ControlDispatcher
Dispatches aPlayer.seekTo(int, long)
operation.- Specified by:
dispatchSeekTo
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.windowIndex
- The index of the window.positionMs
- The seek position in the specified window, orC.TIME_UNSET
to seek to the window's default position.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchPrevious
public boolean dispatchPrevious(Player player)
Description copied from interface:ControlDispatcher
Dispatches aPlayer.previous()
operation.- Specified by:
dispatchPrevious
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchNext
public boolean dispatchNext(Player player)
Description copied from interface:ControlDispatcher
Dispatches aPlayer.next()
operation.- Specified by:
dispatchNext
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchRewind
public boolean dispatchRewind(Player player)
Description copied from interface:ControlDispatcher
Dispatches a rewind operation.- Specified by:
dispatchRewind
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchFastForward
public boolean dispatchFastForward(Player player)
Description copied from interface:ControlDispatcher
Dispatches a fast forward operation.- Specified by:
dispatchFastForward
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchSetRepeatMode
public boolean dispatchSetRepeatMode(Player player, @RepeatMode int repeatMode)
Description copied from interface:ControlDispatcher
Dispatches aPlayer.setRepeatMode(int)
operation.- Specified by:
dispatchSetRepeatMode
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.repeatMode
- The repeat mode.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchSetShuffleModeEnabled
public boolean dispatchSetShuffleModeEnabled(Player player, boolean shuffleModeEnabled)
Description copied from interface:ControlDispatcher
Dispatches aPlayer.setShuffleModeEnabled(boolean)
operation.- Specified by:
dispatchSetShuffleModeEnabled
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.shuffleModeEnabled
- Whether shuffling is enabled.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchStop
public boolean dispatchStop(Player player, boolean reset)
Description copied from interface:ControlDispatcher
Dispatches aPlayer.stop()
operation.- Specified by:
dispatchStop
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.reset
- Whether the player should be reset.- Returns:
- True if the operation was dispatched. False if suppressed.
-
dispatchSetPlaybackParameters
public boolean dispatchSetPlaybackParameters(Player player, PlaybackParameters playbackParameters)
Description copied from interface:ControlDispatcher
Dispatches aPlayer.setPlaybackParameters(PlaybackParameters)
operation.- Specified by:
dispatchSetPlaybackParameters
in interfaceControlDispatcher
- Parameters:
player
- ThePlayer
to which the operation should be dispatched.playbackParameters
- The playback parameters.- Returns:
- True if the operation was dispatched. False if suppressed.
-
isRewindEnabled
public boolean isRewindEnabled()
Description copied from interface:ControlDispatcher
Returnstrue
if rewind is enabled,false
otherwise.- Specified by:
isRewindEnabled
in interfaceControlDispatcher
-
isFastForwardEnabled
public boolean isFastForwardEnabled()
Description copied from interface:ControlDispatcher
Returnstrue
if fast forward is enabled,false
otherwise.- Specified by:
isFastForwardEnabled
in interfaceControlDispatcher
-
getRewindIncrementMs
public long getRewindIncrementMs()
Returns the rewind increment in milliseconds.
-
getFastForwardIncrementMs
public long getFastForwardIncrementMs()
Returns the fast forward increment in milliseconds.
-
setRewindIncrementMs
@Deprecated public void setRewindIncrementMs(long rewindMs)
Deprecated.Create a new instance instead and pass the new instance to the UI component. This makes sure the UI gets updated and is in sync with the new values.
-
setFastForwardIncrementMs
@Deprecated public void setFastForwardIncrementMs(long fastForwardMs)
Deprecated.Create a new instance instead and pass the new instance to the UI component. This makes sure the UI gets updated and is in sync with the new values.
-
-