Class AbstractButtonController
- java.lang.Object
-
- com.brightcove.player.event.AbstractComponent
-
- com.brightcove.player.mediacontroller.buttons.AbstractButtonController
-
- All Implemented Interfaces:
AccessibilityListener,Component,ButtonController,RemoteControlKeyState
- Direct Known Subclasses:
AudioTracksButtonController,CaptionsButtonController,CloseButtonController,FullScreenButtonController,LiveButtonController,PictureInPictureButtonController,PlayButtonController,PlayerOptionsButtonController,SeekButtonController,VRButtonController
public abstract class AbstractButtonController extends AbstractComponent implements ButtonController, RemoteControlKeyState
Provides a class for customers which consists of basic ButtonController method implementations to simplify adding customized media controls.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAbstractButtonController.Visibility
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_AUDIO_TRACKS_BUTTON_IDstatic intDEFAULT_CAPTIONS_BUTTON_IDstatic intDEFAULT_FAST_FORWARD_BUTTON_IDstatic intDEFAULT_FULL_SCREEN_BUTTON_IDstatic intDEFAULT_LIVE_BUTTON_IDstatic intDEFAULT_PLAY_BUTTON_IDstatic intDEFAULT_REWIND_BUTTON_IDstatic intDEFAULT_SEEK_BUTTON_IDprotected java.util.Map<java.lang.String,java.lang.Object>propertiesA set of properties supplied when emitting events as part of button click handling.protected java.util.List<ButtonState>stateListA list of states the button will sequence through as it is clicked.protected BaseVideoViewvideoViewThe Brightcove video view, provided as a convenience to subclasses.-
Fields inherited from class com.brightcove.player.event.AbstractComponent
eventEmitter, listenerTokens
-
-
Constructor Summary
Constructors Constructor Description AbstractButtonController(android.content.Context context, BaseVideoView videoView, android.view.View controlBar, int id, android.graphics.Typeface font)Builds a complete controller.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description android.widget.ButtongetButton()Implements a getter for the button.EventEmittergetEventEmitter()Implements a getter for the SDK event emitter.android.graphics.TypefacegetFont()Gets the button font.intgetId()Obtains the Android resource id for the button being controlled.java.util.Map<java.lang.String,java.lang.Object>getProperties()Implements a default behavior to get the current properties without any additional processing.java.util.List<ButtonState>getStateList()Gets the button state list providing information about the states associated with a button face.intgetVisibilityState()Gets the maintained visibility state for a button.voidonAccessibilityStateChanged(boolean enabled)Called back on change in the accessibility state.booleanonBack(android.view.KeyEvent event)On back key actionedbooleanonDpadCenter(android.view.KeyEvent event)On dpad center key actionedbooleanonDpadDown(android.view.KeyEvent event)On dpad down key actionedbooleanonDpadLeft(android.view.KeyEvent event)On dpad left key actionedbooleanonDpadRight(android.view.KeyEvent event)On dpad right key actionedbooleanonDpadUp(android.view.KeyEvent event)On dpad up key actionedbooleanonFastForward(android.view.KeyEvent event)On fast forward key actionedbooleanonHome(android.view.KeyEvent event)On home key actionedbooleanonMenu(android.view.KeyEvent event)On menu key actionedbooleanonPause(android.view.KeyEvent event)On pause key actionedbooleanonPlay(android.view.KeyEvent event)On play key actionedbooleanonPlayPause(android.view.KeyEvent event)On play pause key actionedbooleanonRewind(android.view.KeyEvent event)On rewind key actionedbooleanonSkipBackward(android.view.KeyEvent event)On skip backward key actionedbooleanonSkipForward(android.view.KeyEvent event)On skip forward key actionedvoidsetVisibility(int visibility)Sets the button visibility.voidsyncStates()Implements to update a state (toggle) button to display the correct glyph and content description for the current managed state value.-
Methods inherited from class com.brightcove.player.event.AbstractComponent
addListener, addOnceListener, removeListener, removeListeners
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.brightcove.player.mediacontroller.buttons.ButtonController
getManagedState, removeListeners
-
-
-
-
Field Detail
-
DEFAULT_AUDIO_TRACKS_BUTTON_ID
public static final int DEFAULT_AUDIO_TRACKS_BUTTON_ID
-
DEFAULT_CAPTIONS_BUTTON_ID
public static final int DEFAULT_CAPTIONS_BUTTON_ID
-
DEFAULT_FAST_FORWARD_BUTTON_ID
public static final int DEFAULT_FAST_FORWARD_BUTTON_ID
-
DEFAULT_FULL_SCREEN_BUTTON_ID
public static final int DEFAULT_FULL_SCREEN_BUTTON_ID
-
DEFAULT_LIVE_BUTTON_ID
public static final int DEFAULT_LIVE_BUTTON_ID
-
DEFAULT_PLAY_BUTTON_ID
public static final int DEFAULT_PLAY_BUTTON_ID
-
DEFAULT_REWIND_BUTTON_ID
public static final int DEFAULT_REWIND_BUTTON_ID
-
DEFAULT_SEEK_BUTTON_ID
public static final int DEFAULT_SEEK_BUTTON_ID
-
properties
protected final java.util.Map<java.lang.String,java.lang.Object> properties
A set of properties supplied when emitting events as part of button click handling.
-
stateList
protected final java.util.List<ButtonState> stateList
A list of states the button will sequence through as it is clicked.
-
videoView
protected final BaseVideoView videoView
The Brightcove video view, provided as a convenience to subclasses.
-
-
Constructor Detail
-
AbstractButtonController
public AbstractButtonController(android.content.Context context, BaseVideoView videoView, android.view.View controlBar, int id, android.graphics.Typeface font)Builds a complete controller.- Parameters:
context- The given Android application context.videoView- The SDK video view used, possibly, to determine managed state asssociated with the button.controlBar- The layout widget to which the button will be added.id- The Android resource identifier for the button being controlled.
-
-
Method Detail
-
getFont
@Nullable public android.graphics.Typeface getFont()
Gets the button font. Used for testing.- Returns:
- The button font.
-
getButton
@Nullable public android.widget.Button getButton()
Implements a getter for the button.- Specified by:
getButtonin interfaceButtonController- Returns:
- null if the controller is not managing an Android Button widget, the managed button otherwise.
- See Also:
ButtonController.getButton()
-
setVisibility
public void setVisibility(int visibility)
Sets the button visibility.- Parameters:
visibility- One ofView.VISIBLE,View.INVISIBLE, orView.GONE.
-
getEventEmitter
public EventEmitter getEventEmitter()
Implements a getter for the SDK event emitter.- Specified by:
getEventEmitterin interfaceButtonController- Overrides:
getEventEmitterin classAbstractComponent- Returns:
- the EventEmitter used by this Component
- See Also:
ButtonController.getEventEmitter()
-
getId
public int getId()
Description copied from interface:ButtonControllerObtains the Android resource id for the button being controlled.- Specified by:
getIdin interfaceButtonController- Returns:
- The Android resource id defining this button controller.
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Implements a default behavior to get the current properties without any additional processing. Subclasses should override to tailor the properties emitted on a button click.- Specified by:
getPropertiesin interfaceButtonController- See Also:
ButtonController.getProperties()
-
getStateList
public java.util.List<ButtonState> getStateList()
Gets the button state list providing information about the states associated with a button face.- Specified by:
getStateListin interfaceButtonController- Returns:
- a non-null but possibly empty list of button states for the controlled button.
- See Also:
ButtonController.getStateList()
-
getVisibilityState
public int getVisibilityState()
Gets the maintained visibility state for a button. Defaults to View.VISIBLE but can be overridden based on events. An example is the caption button.- Specified by:
getVisibilityStatein interfaceButtonController- Returns:
- The expected visibility state, one of View.GONE, View.INVISIBLE or View.VISIBLE.
- See Also:
ButtonController.getVisibilityState()
-
syncStates
public void syncStates()
Implements to update a state (toggle) button to display the correct glyph and content description for the current managed state value.- Specified by:
syncStatesin interfaceButtonController- See Also:
ButtonController.syncStates()
-
onSkipBackward
public boolean onSkipBackward(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn skip backward key actioned- Specified by:
onSkipBackwardin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onSkipForward
public boolean onSkipForward(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn skip forward key actioned- Specified by:
onSkipForwardin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onHome
public boolean onHome(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn home key actioned- Specified by:
onHomein interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onMenu
public boolean onMenu(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn menu key actioned- Specified by:
onMenuin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onBack
public boolean onBack(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn back key actioned- Specified by:
onBackin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onRewind
public boolean onRewind(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn rewind key actioned- Specified by:
onRewindin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onFastForward
public boolean onFastForward(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn fast forward key actioned- Specified by:
onFastForwardin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onPlayPause
public boolean onPlayPause(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn play pause key actioned- Specified by:
onPlayPausein interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onPause
public boolean onPause(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn pause key actioned- Specified by:
onPausein interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onPlay
public boolean onPlay(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn play key actioned- Specified by:
onPlayin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onDpadCenter
public boolean onDpadCenter(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn dpad center key actioned- Specified by:
onDpadCenterin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onDpadRight
public boolean onDpadRight(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn dpad right key actioned- Specified by:
onDpadRightin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onDpadLeft
public boolean onDpadLeft(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn dpad left key actioned- Specified by:
onDpadLeftin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onDpadDown
public boolean onDpadDown(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn dpad down key actioned- Specified by:
onDpadDownin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onDpadUp
public boolean onDpadUp(android.view.KeyEvent event)
Description copied from interface:RemoteControlKeyStateOn dpad up key actioned- Specified by:
onDpadUpin interfaceRemoteControlKeyState- Parameters:
event- the android.view.KeyEvent- Returns:
- true if the key event was handled, false otherwies.
-
onAccessibilityStateChanged
public void onAccessibilityStateChanged(boolean enabled)
Description copied from interface:AccessibilityListenerCalled back on change in the accessibility state.- Specified by:
onAccessibilityStateChangedin interfaceAccessibilityListener- Parameters:
enabled- Whether accessibility is enabled.
-
-