Class 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, the computeTargetSeekPosition(long, long) and the getDidSeekHandler()
  • 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 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, the seekDefaultLong will be set relative to the video duration and the seekPercentage. seekDefaultLong is calculated on EventType.VIDEO_DURATION_CHANGED event.
    • seekPercentage

      protected int seekPercentage
      The percentage number used to calculate the seekDefault based on the video duration. Default value is DEFAULT_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 is DEFAULT_ON_HOLD_START_TIME.
    • onHoldUpdateFrequency

      protected int onHoldUpdateFrequency
      The time in milliseconds, used to send the EventType.SEEKBAR_DRAGGING_PROGRESS event to update the Media Controller seek bar. Default value is DEFAULT_ON_HOLD_UPDATE_FREQUENCY.
    • onHoldHandler

      protected final SeekButtonController.OnHoldHandler 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

      public Map<String,Object> getProperties()
      Implements a getter to add the current playhead position to the payload when emitting a rewind event.
      Specified by:
      getProperties in interface ButtonController
      Overrides:
      getProperties in class AbstractButtonController
      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 interface ButtonController
      Overrides:
      getVisibilityState in class AbstractButtonController
      Returns:
      The expected visibility state, one of View.GONE, View.INVISIBLE or View.VISIBLE.
      See Also:
    • 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, the seekDefaultLong will be set relative to the video duration and the seekPercentage. seekDefaultLong is calculated on EventType.VIDEO_DURATION_CHANGED event.
      Returns:
      true if enabled
    • setSeekRelativeEnabled

      public void setSeekRelativeEnabled(boolean seekRelativeEnabled)
      Enable or disable relative seeking. If enabled, the seekDefaultLong will be set relative to the video duration and the seekPercentage. seekDefaultLong is calculated on EventType.VIDEO_DURATION_CHANGED event.
      Parameters:
      seekRelativeEnabled -
    • getSeekPercentage

      public int getSeekPercentage()
      Gets the seek percentage relative to video duration, used to set the seekDefaultLong 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 the seekDefaultLong 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 the EventType.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 the EventType.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 interface RemoteControlKeyState
      Overrides:
      onDpadCenter in class AbstractButtonController
      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 the setSeekDefault(long) The default offset for a Live video is LIVE_OFFSET
      Parameters:
      seekStartPosition - the seek start position
      offset - 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 the setSeekDefault(long) The default offset for a Live video is LIVE_OFFSET
      Parameters:
      seekStartPosition - the seek start position
      offset - the amount of time in milliseconds to seek.
      Returns:
      the int position in the video to seek to.
      See Also:
    • 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