Class SeekButtonController
java.lang.Object
com.brightcove.player.event.AbstractComponent
com.brightcove.player.mediacontroller.buttons.AbstractButtonController
com.brightcove.player.mediacontroller.buttons.SeekButtonController
- All Implemented Interfaces:
AccessibilityListener
,Component
,ButtonController
,RemoteControlKeyState
- Direct Known Subclasses:
FastForwardButtonController
,RewindButtonController
Provides an abstract class that allows a subclass to either seek back or seek forward.
You are required to implemented both, the
computeTargetSeekPosition(long, long)
and the getDidSeekHandler()
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Provides a handler for hiding the rewind button.protected class
Android Handler used to sendEventType.SEEKBAR_DRAGGING_PROGRESS
event when any of the Seek button is kept held, andEventType.SEEKBAR_DRAGGING_STOP
event when the Seek button was released.protected class
Provides a handler for configuring the SeekButtonController with custom values, which listen forEventType.SEEK_CONTROLLER_CONFIGURATION
event.protected class
Provides a handler for dealing with a rewind operation, before the fact.protected class
Provides a handler for calculating the seekDefault offset based on the length of the video and the seekPercentageprotected class
Provides a handler for hiding the rewind button.Nested classes/interfaces inherited from class com.brightcove.player.mediacontroller.buttons.AbstractButtonController
AbstractButtonController.Visibility
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
protected static final int
protected static final int
protected final SeekButtonController.OnHoldHandler
Instance handler that reacts to control key inputs.protected int
The time in milliseconds, used to send theEventType.SEEKBAR_DRAGGING_PROGRESS
event to update the Media Controller seek bar.protected int
The time in milliseconds to be waited, for the key event to be considered a long press instead of a regular press.protected int
Deprecated.protected long
The default amount of time (milliseconds) the seek button will skip.protected int
The percentage number used to calculate the seekDefault based on the video duration.protected boolean
If enabled, theseekDefaultLong
will be set relative to the video duration and theseekPercentage
.protected int
Deprecated.protected long
The start playhead position for the last seek operation.protected int
Deprecated.protected long
The target playhead position for the last seek operation.Fields inherited from class com.brightcove.player.mediacontroller.buttons.AbstractButtonController
DEFAULT_AUDIO_TRACKS_BUTTON_ID, DEFAULT_CAPTIONS_BUTTON_ID, DEFAULT_FAST_FORWARD_BUTTON_ID, DEFAULT_FULL_SCREEN_BUTTON_ID, DEFAULT_LIVE_BUTTON_ID, DEFAULT_PLAY_BUTTON_ID, DEFAULT_REWIND_BUTTON_ID, DEFAULT_SEEK_BUTTON_ID, properties, stateList, videoView
Fields inherited from class com.brightcove.player.event.AbstractComponent
eventEmitter, listenerTokens
-
Constructor Summary
ConstructorDescriptionSeekButtonController
(android.content.Context context, BaseVideoView videoView, android.view.View controlBar, int id, android.graphics.Typeface font, String eventType) Builds a button controller to handle the rewind button. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract int
computeTargetSeekPosition
(int seekStartPosition, int offset) Deprecated.protected abstract long
computeTargetSeekPosition
(long seekStartPosition, long offset) Compute the target seek position based on the seekStartPosition and an offset.protected abstract EventListener
Gets the EventListener callback to trigger when the DID_SEEK_TO event is received.int
Implements a getter for the managed state.int
Gets the on hold update frequency time in milliseconds, used to send theEventType.SEEKBAR_DRAGGING_PROGRESS
event to update the Media Controller seek bar.int
Gets the on hold button wait time, which is the time in milliseconds to be waited, so that the key event is considered a long press instead of a regular press.Implements a getter to add the current playhead position to the payload when emitting a rewind event.int
Deprecated.long
Gets default seek time.int
Gets the seek percentage relative to video duration, used to set theseekDefaultLong
The values are greater than 0 and lower than 100int
Gets the current visibility state.protected boolean
handleSeekEvent
(android.view.KeyEvent event) boolean
If enabled, theseekDefaultLong
will be set relative to the video duration and theseekPercentage
.boolean
onDpadCenter
(android.view.KeyEvent event) On dpad center key actionedvoid
setOnHoldUpdateFrequency
(int onHoldUpdateFrequency) Sets the on hold update frequency time in milliseconds, used to send theEventType.SEEKBAR_DRAGGING_PROGRESS
event to update the Media Controller seek bar.void
setOnHoldWaitTime
(int onHoldWaitTime) Sets the on hold button wait time, which is the time in milliseconds to be waited, so that the key event is considered a long press instead of a regular press.void
setSeekDefault
(int value) Deprecated.void
setSeekDefault
(long value) Sets the default seek time.void
setSeekPercentage
(int seekPercentage) Sets the seek percentage relative to video duration, used to set theseekDefaultLong
The values are greater than 0 and lower than 100void
setSeekRelativeEnabled
(boolean seekRelativeEnabled) Enable or disable relative seeking.Methods inherited from class com.brightcove.player.mediacontroller.buttons.AbstractButtonController
getButton, getEventEmitter, getFont, getId, getStateList, onAccessibilityStateChanged, onBack, onDpadDown, onDpadLeft, onDpadRight, onDpadUp, onFastForward, onHome, onMenu, onPause, onPlay, onPlayPause, onRewind, onSkipBackward, onSkipForward, setVisibility, syncStates
Methods inherited from class com.brightcove.player.event.AbstractComponent
addListener, addOnceListener, removeListener, removeListeners
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.brightcove.player.mediacontroller.buttons.ButtonController
removeListeners
-
Field Details
-
LIVE_OFFSET
protected static final int LIVE_OFFSET- See Also:
-
DEFAULT_SEEK_PERCENTAGE
protected static final int DEFAULT_SEEK_PERCENTAGE- See Also:
-
DEFAULT_ON_HOLD_START_TIME
protected static final int DEFAULT_ON_HOLD_START_TIME- See Also:
-
DEFAULT_ON_HOLD_UPDATE_FREQUENCY
protected static final int DEFAULT_ON_HOLD_UPDATE_FREQUENCY- See Also:
-
seekDefault
Deprecated.The default amount of time (milliseconds) the seek button will skip. -
seekDefaultLong
protected long seekDefaultLongThe default amount of time (milliseconds) the seek button will skip. -
seekStartPosition
Deprecated.The start playhead position for the last seek operation. -
seekStartPositionLong
protected long seekStartPositionLongThe start playhead position for the last seek operation. -
seekTargetPosition
Deprecated.The target playhead position for the last seek operation. -
seekTargetPositionLong
protected long seekTargetPositionLongThe target playhead position for the last seek operation. -
seekRelativeEnabled
protected boolean seekRelativeEnabledIf enabled, theseekDefaultLong
will be set relative to the video duration and theseekPercentage
.seekDefaultLong
is calculated onEventType.VIDEO_DURATION_CHANGED
event. -
seekPercentage
protected int seekPercentageThe percentage number used to calculate the seekDefault based on the video duration. Default value isDEFAULT_SEEK_PERCENTAGE
. -
onHoldWaitTime
protected int onHoldWaitTimeThe time in milliseconds to be waited, for the key event to be considered a long press instead of a regular press. Default value isDEFAULT_ON_HOLD_START_TIME
. -
onHoldUpdateFrequency
protected int onHoldUpdateFrequencyThe time in milliseconds, used to send theEventType.SEEKBAR_DRAGGING_PROGRESS
event to update the Media Controller seek bar. Default value isDEFAULT_ON_HOLD_UPDATE_FREQUENCY
. -
onHoldHandler
Instance handler that reacts to control key inputs.
-
-
Constructor Details
-
SeekButtonController
public SeekButtonController(@NonNull android.content.Context context, @NonNull BaseVideoView videoView, @NonNull android.view.View controlBar, int id, @Nullable android.graphics.Typeface font, String eventType) Builds a button controller to handle the rewind button.- Parameters:
context
- The Android application context.videoView
- The SDK video view object parenting the control bar.controlBar
- The button widget parent view.font
- The, possibly null, typeface for the button.
-
-
Method Details
-
getManagedState
public int getManagedState()Implements a getter for the managed state.- See Also:
-
getProperties
Implements a getter to add the current playhead position to the payload when emitting a rewind event.- Specified by:
getProperties
in interfaceButtonController
- Overrides:
getProperties
in classAbstractButtonController
- See Also:
-
getVisibilityState
public int getVisibilityState()Gets the current visibility state. For the Rewind button, it is visible in non-live videos and when a DVR capability is detected with live videos.- Specified by:
getVisibilityState
in interfaceButtonController
- Overrides:
getVisibilityState
in classAbstractButtonController
- Returns:
- The expected visibility state, one of View.GONE, View.INVISIBLE or View.VISIBLE.
- See Also:
-
getSeekDefault
Deprecated.Deprecated. Instead use {getSeekDefaultLong()
} -
getSeekDefaultLong
public long getSeekDefaultLong()Gets default seek time.- Returns:
- the seek time in milliseconds
-
setSeekDefault
Deprecated.Deprecated. Instead use {setSeekDefault(long)
} -
setSeekDefault
public void setSeekDefault(long value) Sets the default seek time.- Parameters:
value
- The number of milliseconds to seek.
-
isSeekRelativeEnabled
public boolean isSeekRelativeEnabled()If enabled, theseekDefaultLong
will be set relative to the video duration and theseekPercentage
.seekDefaultLong
is calculated onEventType.VIDEO_DURATION_CHANGED
event.- Returns:
- true if enabled
-
setSeekRelativeEnabled
public void setSeekRelativeEnabled(boolean seekRelativeEnabled) Enable or disable relative seeking. If enabled, theseekDefaultLong
will be set relative to the video duration and theseekPercentage
.seekDefaultLong
is calculated onEventType.VIDEO_DURATION_CHANGED
event.- Parameters:
seekRelativeEnabled
-
-
getSeekPercentage
public int getSeekPercentage()Gets the seek percentage relative to video duration, used to set theseekDefaultLong
The values are greater than 0 and lower than 100- Returns:
- the seek percentage
-
setSeekPercentage
public void setSeekPercentage(int seekPercentage) Sets the seek percentage relative to video duration, used to set theseekDefaultLong
The values are greater than 0 and lower than 100- Parameters:
seekPercentage
- the seek percentage
-
getOnHoldWaitTime
public int getOnHoldWaitTime()Gets the on hold button wait time, which is the time in milliseconds to be waited, so that the key event is considered a long press instead of a regular press.- Returns:
- the on hold start time
-
setOnHoldWaitTime
public void setOnHoldWaitTime(int onHoldWaitTime) Sets the on hold button wait time, which is the time in milliseconds to be waited, so that the key event is considered a long press instead of a regular press.- Parameters:
onHoldWaitTime
- the on hold start time
-
getOnHoldUpdateFrequency
public int getOnHoldUpdateFrequency()Gets the on hold update frequency time in milliseconds, used to send theEventType.SEEKBAR_DRAGGING_PROGRESS
event to update the Media Controller seek bar.- Returns:
- the time in milliseconds
-
setOnHoldUpdateFrequency
public void setOnHoldUpdateFrequency(int onHoldUpdateFrequency) Sets the on hold update frequency time in milliseconds, used to send theEventType.SEEKBAR_DRAGGING_PROGRESS
event to update the Media Controller seek bar.- Parameters:
onHoldUpdateFrequency
- the time in milliseconds
-
onDpadCenter
public boolean onDpadCenter(android.view.KeyEvent event) Description copied from interface:RemoteControlKeyState
On dpad center key actioned- Specified by:
onDpadCenter
in interfaceRemoteControlKeyState
- Overrides:
onDpadCenter
in classAbstractButtonController
- Parameters:
event
- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
handleSeekEvent
protected boolean handleSeekEvent(android.view.KeyEvent event) -
computeTargetSeekPosition
Deprecated.Compute the target seek position based on the seekStartPosition and an offset. The offset can be overridden by calling thesetSeekDefault(long)
The default offset for a Live video isLIVE_OFFSET
- Parameters:
seekStartPosition
- the seek start positionoffset
- the amount of time in milliseconds to seek.- Returns:
- the int position in the video to seek to.
- See Also:
-
computeTargetSeekPosition
protected abstract long computeTargetSeekPosition(long seekStartPosition, long offset) Compute the target seek position based on the seekStartPosition and an offset. The offset can be overridden by calling thesetSeekDefault(long)
The default offset for a Live video isLIVE_OFFSET
- Parameters:
seekStartPosition
- the seek start positionoffset
- the amount of time in milliseconds to seek.- Returns:
- the int position in the video to seek to.
- See Also:
-
getDidSeekHandler
Gets the EventListener callback to trigger when the DID_SEEK_TO event is received.- Returns:
- EventListener who listens for DID_SEEK_TO
-