Class 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 Detail

      • DEFAULT_TIMEOUT

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

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

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

        public static final java.lang.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:
        Constant Field Values
      • PROGRESS

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

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

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

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

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

      • 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 Detail

      • 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:
        VideoDisplayComponent.isLive()
      • 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.
      • 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.
      • 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.
      • 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