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
public abstract class SeekButtonController extends AbstractButtonController
Provides an abstract class that allows a subclass to either seek back or seek forward. You are required to implemented both, thecomputeTargetSeekPosition(long, long)
and thegetDidSeekHandler()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
SeekButtonController.HideSeekControlsHandler
Provides a handler for hiding the rewind button.protected class
SeekButtonController.OnHoldHandler
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
SeekButtonController.SeekConfigurationHandler
Provides a handler for configuring the SeekButtonController with custom values, which listen forEventType.SEEK_CONTROLLER_CONFIGURATION
event.protected class
SeekButtonController.SeekHandler
Provides a handler for dealing with a rewind operation, before the fact.protected class
SeekButtonController.SeekOffsetHandler
Provides a handler for calculating the seekDefault offset based on the length of the video and the seekPercentageprotected class
SeekButtonController.ShowSeekControlsHandler
Provides a handler for hiding the rewind button.-
Nested classes/interfaces inherited from class com.brightcove.player.mediacontroller.buttons.AbstractButtonController
AbstractButtonController.Visibility
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_ON_HOLD_START_TIME
protected static int
DEFAULT_ON_HOLD_UPDATE_FREQUENCY
protected static int
DEFAULT_SEEK_PERCENTAGE
protected static int
LIVE_OFFSET
protected SeekButtonController.OnHoldHandler
onHoldHandler
Instance handler that reacts to control key inputs.protected int
onHoldUpdateFrequency
The time in milliseconds, used to send theEventType.SEEKBAR_DRAGGING_PROGRESS
event to update the Media Controller seek bar.protected int
onHoldWaitTime
The time in milliseconds to be waited, for the key event to be considered a long press instead of a regular press.protected int
seekDefault
Deprecated.protected long
seekDefaultLong
The default amount of time (milliseconds) the seek button will skip.protected int
seekPercentage
The percentage number used to calculate the seekDefault based on the video duration.protected boolean
seekRelativeEnabled
If enabled, theseekDefaultLong
will be set relative to the video duration and theseekPercentage
.protected int
seekStartPosition
Deprecated.protected long
seekStartPositionLong
The start playhead position for the last seek operation.protected int
seekTargetPosition
Deprecated.protected long
seekTargetPositionLong
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
Constructors Constructor Description SeekButtonController(android.content.Context context, BaseVideoView videoView, android.view.View controlBar, int id, android.graphics.Typeface font, java.lang.String eventType)
Builds a button controller to handle the rewind button.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected 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
getDidSeekHandler()
Gets the EventListener callback to trigger when the DID_SEEK_TO event is received.int
getManagedState()
Implements a getter for the managed state.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.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.java.util.Map<java.lang.String,java.lang.Object>
getProperties()
Implements a getter to add the current playhead position to the payload when emitting a rewind event.int
getSeekDefault()
Deprecated.long
getSeekDefaultLong()
Gets default seek time.int
getSeekPercentage()
Gets the seek percentage relative to video duration, used to set theseekDefaultLong
The values are greater than 0 and lower than 100int
getVisibilityState()
Gets the current visibility state.protected boolean
handleSeekEvent(android.view.KeyEvent event)
boolean
isSeekRelativeEnabled()
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 Detail
-
LIVE_OFFSET
protected static final int LIVE_OFFSET
- See Also:
- Constant Field Values
-
DEFAULT_SEEK_PERCENTAGE
protected static final int DEFAULT_SEEK_PERCENTAGE
- See Also:
- Constant Field Values
-
DEFAULT_ON_HOLD_START_TIME
protected static final int DEFAULT_ON_HOLD_START_TIME
- See Also:
- Constant Field Values
-
DEFAULT_ON_HOLD_UPDATE_FREQUENCY
protected static final int DEFAULT_ON_HOLD_UPDATE_FREQUENCY
- See Also:
- Constant Field Values
-
seekDefault
@Deprecated protected int seekDefault
Deprecated.The default amount of time (milliseconds) the seek button will skip.
-
seekDefaultLong
protected long seekDefaultLong
The default amount of time (milliseconds) the seek button will skip.
-
seekStartPosition
@Deprecated protected int seekStartPosition
Deprecated.The start playhead position for the last seek operation.
-
seekStartPositionLong
protected long seekStartPositionLong
The start playhead position for the last seek operation.
-
seekTargetPosition
@Deprecated protected int seekTargetPosition
Deprecated.The target playhead position for the last seek operation.
-
seekTargetPositionLong
protected long seekTargetPositionLong
The target playhead position for the last seek operation.
-
seekRelativeEnabled
protected boolean seekRelativeEnabled
If enabled, theseekDefaultLong
will be set relative to the video duration and theseekPercentage
.seekDefaultLong
is calculated onEventType.VIDEO_DURATION_CHANGED
event.
-
seekPercentage
protected int seekPercentage
The percentage number used to calculate the seekDefault based on the video duration. Default value isDEFAULT_SEEK_PERCENTAGE
.
-
onHoldWaitTime
protected int onHoldWaitTime
The 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 onHoldUpdateFrequency
The 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
protected final SeekButtonController.OnHoldHandler onHoldHandler
Instance handler that reacts to control key inputs.
-
-
Constructor Detail
-
SeekButtonController
public SeekButtonController(@NonNull android.content.Context context, @NonNull BaseVideoView videoView, @NonNull android.view.View controlBar, int id, @Nullable android.graphics.Typeface font, java.lang.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 Detail
-
getManagedState
public int getManagedState()
Implements a getter for the managed state.- See Also:
ButtonController.getManagedState()
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> 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:
ButtonController.getProperties()
-
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:
ButtonController.getVisibilityState()
-
getSeekDefault
@Deprecated public int getSeekDefault()
Deprecated.Deprecated. Instead use {getSeekDefaultLong()
}
-
getSeekDefaultLong
public long getSeekDefaultLong()
Gets default seek time.- Returns:
- the seek time in milliseconds
-
setSeekDefault
@Deprecated public void setSeekDefault(int value)
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 protected abstract int computeTargetSeekPosition(int seekStartPosition, int offset)
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:
setSeekDefault(long)
-
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:
setSeekDefault(long)
-
getDidSeekHandler
protected abstract EventListener getDidSeekHandler()
Gets the EventListener callback to trigger when the DID_SEEK_TO event is received.- Returns:
- EventListener who listens for DID_SEEK_TO
-
-