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 Summary
Fields Modifier and Type Field Description static java.lang.StringCONTROL_BAR_CREATEDThe event type emitted by the Brightcove media controller that provides for customization.static intDEFAULT_TIMEOUTThe default show/hide timeout value, in milliseconds.static java.lang.StringDURATIONThe event payload key for the duration time text value.booleanisTvModeboolean set on the constructor to check if we are on TV modestatic java.lang.StringMARKER_LISTThe event property key specifying the playhead positions at which markers should be placed.static java.lang.StringPROGRESSThe event payload key for the current time text value.static java.lang.StringSEEK_BAR_MAXThe event property key for saving and restoring the seek bar max value.static java.lang.StringSEEK_BAR_PROGRESSThe event property key for saving and restoring the seek bar progress value.static java.lang.StringSET_MARKERSStandard 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
Constructors Constructor Description BrightcoveMediaController(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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleancheckTvMode(android.content.Context context)Checks whether the current mode type is Configuration.UI_MODE_TYPE_TELEVISION or not.booleandispatchKeyEvent(android.view.KeyEvent event)Dispatch the key event.BrightcoveControlBargetBrightcoveControlBar()Obtains the current control bar.BrightcoveSeekBargetBrightcoveSeekBar()Obtains the current seek bar.BrightcoveMediaControlRegistrygetMediaControlRegistry()Obtains the button controller registry.intgetSeekBarOffset()Deprecated.longgetSeekBarOffsetLong()Gets the live fixed sliding window offset.voidhide()Hides the media controls.protected voidinit(BaseVideoView videoView, int layout)Initialize the BrightcoveMediaController instance.booleanisDragging()Obtains the dragging state.booleanisDVRControllerEnabled()Checks if the DVR controller is enabled.booleanisHideControllerEnable()It indicates whether the hide mechanism of the ShowHideController is enable or disable.booleanisShowControllerEnable()It indicates whether the hide mechanism of the ShowHideController is enable or disable.booleanisShowing()Determines whether or not the media controls are showing.voidremoveListeners()Removes all set listeners from the EventEmitter.voidsetCuePointMarkersEnabled(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.voidsetDVRControllerEnabled(boolean enable)Enables or disables the DVR controller.voidsetHideControllerEnable(boolean hideControllerEnable)The ShowHideController reacts to several events which causes the Media Controller to hide.voidsetShowControllerEnable(boolean showControllerEnable)The ShowHideController reacts to several events which causes the Media Controller to show.voidsetShowHideAnimationStyle(com.brightcove.player.mediacontroller.BrightcoveMediaController.AnimationStyle value)Sets the animation style.voidsetShowHideTimeout(int value)Sets the animation timeout.voidshow()Shows the media controls.protected voidupdateKeyStates(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 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:
TRUEiff 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:
hidein interfaceShowHideController- See Also:
ShowHideController.hide()
-
isShowing
public boolean isShowing()
Determines whether or not the media controls are showing.- Specified by:
isShowingin interfaceShowHideController- Returns:
TRUEiff the media controls are showing, false otherwise.- See Also:
ShowHideController.isShowing()
-
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:
showin interfaceShowHideController- See Also:
ShowHideController.show()
-
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
MediaControllerKeyDispatcherhas been set through theMediaControllerConfig, itsMediaControllerKeyDispatcher.dispatchKeyEvent(KeyEvent)will be called. When either theMediaControllerKeyDispatcheris 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:AbstractComponentRemoves all set listeners from the EventEmitter.- Overrides:
removeListenersin classAbstractComponent
-
-