Class BrightcoveMediaController
- All Implemented Interfaces:
Component
,ShowHideController
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 Summary
Modifier and TypeFieldDescriptionstatic final String
The event type emitted by the Brightcove media controller that provides for customization.static final int
The default show/hide timeout value, in milliseconds.static final String
The event payload key for the duration time text value.final boolean
boolean set on the constructor to check if we are on TV modestatic final String
The event property key specifying the playhead positions at which markers should be placed.static final String
The event payload key for the current time text value.static final String
The event property key for saving and restoring the seek bar max value.static final String
The event property key for saving and restoring the seek bar progress value.static final String
Standard event type for supplying markers to the seek bar.Fields inherited from class com.brightcove.player.event.AbstractComponent
eventEmitter, listenerTokens
Fields inherited from interface com.brightcove.player.mediacontroller.ShowHideController
ANIMATION_STYLE_FADE, ANIMATION_STYLE_SLIDE, CONTROLS_HEIGHT, DID_HIDE_MEDIA_CONTROLS, DID_SHOW_MEDIA_CONTROLS, HIDE_MEDIA_CONTROLS, SHOW_HIDE_ANIMATION_STYLE, SHOW_HIDE_RESOURCES, SHOW_HIDE_TIMEOUT, SHOW_MEDIA_CONTROLS
-
Constructor Summary
ConstructorDescriptionBrightcoveMediaController
(BaseVideoView videoView) Builds a default media controller for a given video view.BrightcoveMediaController
(BaseVideoView videoView, int layout) Builds a media controller for a given video view and layout. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkTvMode
(android.content.Context context) Checks whether the current mode type is Configuration.UI_MODE_TYPE_TELEVISION or not.boolean
dispatchKeyEvent
(android.view.KeyEvent event) Dispatch the key event.Obtains the current control bar.Obtains the current seek bar.Obtains the button controller registry.int
Deprecated.long
Gets the live fixed sliding window offset.void
hide()
Hides the media controls.protected void
init
(BaseVideoView videoView, int layout) Initialize the BrightcoveMediaController instance.boolean
Obtains the dragging state.boolean
Checks if the DVR controller is enabled.boolean
It indicates whether the hide mechanism of the ShowHideController is enable or disable.boolean
It indicates whether the hide mechanism of the ShowHideController is enable or disable.boolean
Determines whether or not the media controls are showing.void
Removes all set listeners from the EventEmitter.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.void
setDVRControllerEnabled
(boolean enable) Enables or disables the DVR controller.void
setHideControllerEnable
(boolean hideControllerEnable) The ShowHideController reacts to several events which causes the Media Controller to hide.void
setShowControllerEnable
(boolean showControllerEnable) The ShowHideController reacts to several events which causes the Media Controller to show.void
setShowHideAnimationStyle
(com.brightcove.player.mediacontroller.BrightcoveMediaController.AnimationStyle value) Sets the animation style.void
setShowHideTimeout
(int value) Sets the animation timeout.void
show()
Shows the media controls.protected void
updateKeyStates
(android.view.KeyEvent event) Update current RemoteControlKeyState, which is the media player button with the focus.Methods inherited from class com.brightcove.player.event.AbstractComponent
addListener, addOnceListener, getEventEmitter, removeListener
-
Field Details
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUTThe default show/hide timeout value, in milliseconds.- See Also:
-
CONTROL_BAR_CREATED
The event type emitted by the Brightcove media controller that provides for customization.- See Also:
-
DURATION
The event payload key for the duration time text value.- See Also:
-
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
The event payload key for the current time text value.- See Also:
-
SEEK_BAR_PROGRESS
The event property key for saving and restoring the seek bar progress value.- See Also:
-
SEEK_BAR_MAX
The event property key for saving and restoring the seek bar max value.- See Also:
-
SET_MARKERS
Standard event type for supplying markers to the seek bar.- See Also:
-
isTvMode
public final boolean isTvModeboolean set on the constructor to check if we are on TV mode
-
-
Constructor Details
-
BrightcoveMediaController
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
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
Initialize the BrightcoveMediaController instance.- Parameters:
videoView
- The given Brightcove video view object.layout
- The given layout resource identifier.
-
getBrightcoveControlBar
Obtains the current control bar.- Returns:
- null if a control bar has not been initialized or the Brightcove control bar otherwise.
-
getBrightcoveSeekBar
Obtains the current seek bar.- Returns:
- null if a seek bar has not been initialized or the Brightcove seek bar otherwise.
-
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
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 interfaceShowHideController
- See Also:
-
isShowing
public boolean isShowing()Determines whether or not the media controls are showing.- Specified by:
isShowing
in interfaceShowHideController
- 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 interfaceShowHideController
- 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 theMediaControllerConfig
, itsMediaControllerKeyDispatcher.dispatchKeyEvent(KeyEvent)
will be called. When either theMediaControllerKeyDispatcher
is not set or whenMediaControllerKeyDispatcher.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 classAbstractComponent
-