Class BrightcoveMediaController

java.lang.Object
com.brightcove.player.event.AbstractComponent
com.brightcove.player.mediacontroller.BrightcoveMediaController
All Implemented Interfaces:
Component, ShowHideController

public class BrightcoveMediaController extends AbstractComponent implements ShowHideController
The default Brightcove media controller patterned on the Brightcove Web Player.

The media controller provides a container for managing the large play button and the media controls (including control bar, seekbar and the defined set of media control buttons and views) as well as managing the activity lifecycle for these controls.

  • Field Details

    • DEFAULT_TIMEOUT

      public static final int DEFAULT_TIMEOUT
      The default show/hide timeout value, in milliseconds.
      See Also:
    • CONTROL_BAR_CREATED

      public static final String CONTROL_BAR_CREATED
      The event type emitted by the Brightcove media controller that provides for customization.
      See Also:
    • DURATION

      public static final String DURATION
      The event payload key for the duration time text value.
      See Also:
    • MARKER_LIST

      public static final String MARKER_LIST
      The event property key specifying the playhead positions at which markers should be placed. The value must be of type: List. A missing or empty list will result in all markers being removed.
      See Also:
    • PROGRESS

      public static final String PROGRESS
      The event payload key for the current time text value.
      See Also:
    • SEEK_BAR_PROGRESS

      public static final String SEEK_BAR_PROGRESS
      The event property key for saving and restoring the seek bar progress value.
      See Also:
    • SEEK_BAR_MAX

      public static final String SEEK_BAR_MAX
      The event property key for saving and restoring the seek bar max value.
      See Also:
    • SET_MARKERS

      public static final String SET_MARKERS
      Standard event type for supplying markers to the seek bar.
      See Also:
    • isTvMode

      public final boolean isTvMode
      boolean set on the constructor to check if we are on TV mode
  • Constructor Details

    • BrightcoveMediaController

      public BrightcoveMediaController(BaseVideoView videoView)
      Builds a default media controller for a given video view. It will default to using the default layout supplied by Brightcove.
      Parameters:
      videoView - The Brightcove video view object which will be attached to this media controller.
    • BrightcoveMediaController

      public BrightcoveMediaController(BaseVideoView videoView, int layout)
      Builds a media controller for a given video view and layout.
      Parameters:
      videoView - The given Brightcove video view object.
      layout - The given layout resource identifier.
  • Method Details

    • init

      protected void init(BaseVideoView videoView, int layout)
      Initialize the BrightcoveMediaController instance.
      Parameters:
      videoView - The given Brightcove video view object.
      layout - The given layout resource identifier.
    • getBrightcoveControlBar

      public BrightcoveControlBar getBrightcoveControlBar()
      Obtains the current control bar.
      Returns:
      null if a control bar has not been initialized or the Brightcove control bar otherwise.
    • getBrightcoveSeekBar

      public BrightcoveSeekBar getBrightcoveSeekBar()
      Obtains the current seek bar.
      Returns:
      null if a seek bar has not been initialized or the Brightcove seek bar otherwise.
    • getSeekBarOffset

      @Deprecated public int getSeekBarOffset()
      Deprecated.
      Deprecated. Instead use {getSeekBarOffsetLong()}
    • getSeekBarOffsetLong

      public long getSeekBarOffsetLong()
      Gets the live fixed sliding window offset.
      Returns:
      the seek bar offset.
      See Also:
    • getMediaControlRegistry

      public BrightcoveMediaControlRegistry getMediaControlRegistry()
      Obtains the button controller registry.
      Returns:
      The, possibly empty, button controller registry.
    • isDVRControllerEnabled

      public boolean isDVRControllerEnabled()
      Checks if the DVR controller is enabled. It only applies for Live videos. It is enabled by default.

      If it is disabled and the current video is live stream, the BrightcoveMediaController will disable several buttons, for example, the SeekBar and the Rewind button.

      Returns:
      true if enabled
    • setDVRControllerEnabled

      public void setDVRControllerEnabled(boolean enable)
      Enables or disables the DVR controller. It only applies for Live videos.
      Parameters:
      enable - true to enable
    • isDragging

      public boolean isDragging()
      Obtains the dragging state.
      Returns:
      TRUE iff the User is currently moving the scrubber along the seek bar.
    • setCuePointMarkersEnabled

      public void setCuePointMarkersEnabled(boolean state)
      Set the enable/disable state that allows (enabled) or prevents (disabled) ad markers being set automatically whenever a cue point has been set.
      Parameters:
      state - The enable (true) or disable (false) state value. True iff mid-roll ad markers should be placed on the seek bar whenever a cue point is set.
    • hide

      public void hide()
      Hides the media controls.
      Specified by:
      hide in interface ShowHideController
      See Also:
    • isShowing

      public boolean isShowing()
      Determines whether or not the media controls are showing.
      Specified by:
      isShowing in interface ShowHideController
      Returns:
      TRUE iff the media controls are showing, false otherwise.
      See Also:
    • isShowControllerEnable

      public boolean isShowControllerEnable()
      It indicates whether the hide mechanism of the ShowHideController is enable or disable. It's enabled by default.
      Returns:
      true if enabled.
    • isHideControllerEnable

      public boolean isHideControllerEnable()
      It indicates whether the hide mechanism of the ShowHideController is enable or disable. It's enabled by default.
      Returns:
      true if enabled.
    • setShowControllerEnable

      public void setShowControllerEnable(boolean showControllerEnable)
      The ShowHideController reacts to several events which causes the Media Controller to show. This methods allows you to enable or disable the hide functionality. It's enabled by default.
      Parameters:
      showControllerEnable - true to enable.
    • setHideControllerEnable

      public void setHideControllerEnable(boolean hideControllerEnable)
      The ShowHideController reacts to several events which causes the Media Controller to hide. This methods allows you to enable or disable the hide functionality. It's enabled by default.
      Parameters:
      hideControllerEnable - true to enable.
    • setShowHideAnimationStyle

      public void setShowHideAnimationStyle(com.brightcove.player.mediacontroller.BrightcoveMediaController.AnimationStyle value)
      Sets the animation style.
      Parameters:
      value - The new animation style.
    • setShowHideTimeout

      public void setShowHideTimeout(int value)
      Sets the animation timeout.
      Parameters:
      value - The new animation timeout, in milliseconds.
    • show

      public void show()
      Shows the media controls.
      Specified by:
      show in interface ShowHideController
      See Also:
    • checkTvMode

      public static boolean checkTvMode(android.content.Context context)
      Checks whether the current mode type is Configuration.UI_MODE_TYPE_TELEVISION or not.
      Parameters:
      context - Android context used to get the UiModeManager
      Returns:
      true if we're running on a Android TV.
    • dispatchKeyEvent

      public boolean dispatchKeyEvent(android.view.KeyEvent event)
      Dispatch the key event. This method has be to be called from a Android View, overriding the it's dispatchKeyEven method.

      When a MediaControllerKeyDispatcher has been set through the MediaControllerConfig, its MediaControllerKeyDispatcher.dispatchKeyEvent(KeyEvent) will be called. When either the MediaControllerKeyDispatcher is not set or when MediaControllerKeyDispatcher.dispatchKeyEvent(KeyEvent) returns false, the default dispatch key event implementation will be used.

      Parameters:
      event - the android.View.KeyEvent
      Returns:
      true if the key event was handled, or false to let it be handled by the View
    • updateKeyStates

      protected void updateKeyStates(android.view.KeyEvent event)
      Update current RemoteControlKeyState, which is the media player button with the focus. The default RemoteControlKeyState is the Play Button. The state will be updated when the event actions is ACTION_UP
      Parameters:
      event - the android.View.KeyEvent
    • removeListeners

      public void removeListeners()
      Description copied from class: AbstractComponent
      Removes all set listeners from the EventEmitter.
      Overrides:
      removeListeners in class AbstractComponent