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 intDEFAULT_FAST_FORWARD_MSThe default fast forward increment, in milliseconds.static intDEFAULT_REWIND_MSThe 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 booleandispatchFastForward(Player player)Dispatches a fast forward operation.booleandispatchNext(Player player)Dispatches aPlayer.next()operation.booleandispatchPrepare(Player player)Dispatches aPlayer.prepare()operation.booleandispatchPrevious(Player player)Dispatches aPlayer.previous()operation.booleandispatchRewind(Player player)Dispatches a rewind operation.booleandispatchSeekTo(Player player, int windowIndex, long positionMs)Dispatches aPlayer.seekTo(int, long)operation.booleandispatchSetPlaybackParameters(Player player, PlaybackParameters playbackParameters)Dispatches aPlayer.setPlaybackParameters(PlaybackParameters)operation.booleandispatchSetPlayWhenReady(Player player, boolean playWhenReady)Dispatches aPlayer.setPlayWhenReady(boolean)operation.booleandispatchSetRepeatMode(Player player, int repeatMode)Dispatches aPlayer.setRepeatMode(int)operation.booleandispatchSetShuffleModeEnabled(Player player, boolean shuffleModeEnabled)Dispatches aPlayer.setShuffleModeEnabled(boolean)operation.booleandispatchStop(Player player, boolean reset)Dispatches aPlayer.stop()operation.longgetFastForwardIncrementMs()Returns the fast forward increment in milliseconds.longgetRewindIncrementMs()Returns the rewind increment in milliseconds.booleanisFastForwardEnabled()Returnstrueif fast forward is enabled,falseotherwise.booleanisRewindEnabled()Returnstrueif rewind is enabled,falseotherwise.voidsetFastForwardIncrementMs(long fastForwardMs)Deprecated.Create a new instance instead and pass the new instance to the UI component.voidsetRewindIncrementMs(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:ControlDispatcherDispatches aPlayer.prepare()operation.- Specified by:
dispatchPreparein interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherDispatches aPlayer.setPlayWhenReady(boolean)operation.- Specified by:
dispatchSetPlayWhenReadyin interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherDispatches aPlayer.seekTo(int, long)operation.- Specified by:
dispatchSeekToin interfaceControlDispatcher- Parameters:
player- ThePlayerto which the operation should be dispatched.windowIndex- The index of the window.positionMs- The seek position in the specified window, orC.TIME_UNSETto 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:ControlDispatcherDispatches aPlayer.previous()operation.- Specified by:
dispatchPreviousin interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherDispatches aPlayer.next()operation.- Specified by:
dispatchNextin interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherDispatches a rewind operation.- Specified by:
dispatchRewindin interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherDispatches a fast forward operation.- Specified by:
dispatchFastForwardin interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherDispatches aPlayer.setRepeatMode(int)operation.- Specified by:
dispatchSetRepeatModein interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherDispatches aPlayer.setShuffleModeEnabled(boolean)operation.- Specified by:
dispatchSetShuffleModeEnabledin interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherDispatches aPlayer.stop()operation.- Specified by:
dispatchStopin interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherDispatches aPlayer.setPlaybackParameters(PlaybackParameters)operation.- Specified by:
dispatchSetPlaybackParametersin interfaceControlDispatcher- Parameters:
player- ThePlayerto 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:ControlDispatcherReturnstrueif rewind is enabled,falseotherwise.- Specified by:
isRewindEnabledin interfaceControlDispatcher
-
isFastForwardEnabled
public boolean isFastForwardEnabled()
Description copied from interface:ControlDispatcherReturnstrueif fast forward is enabled,falseotherwise.- Specified by:
isFastForwardEnabledin 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.
-
-