-
- All Implemented Interfaces:
-
com.brightcove.player.event.Component
@ListensFor(events = {EventType.CAPTIONS_LANGUAGES, EventType.STOP, EventType.ENTER_TV_MODE, EventType.HIDE_PLAYER_OPTIONS, EventType.ACTIVITY_RESUMED})@Emits(events = {EventType.CAPTIONS_DIALOG_OK, EventType.CAPTIONS_DIALOG_SETTINGS, EventType.TOGGLE_CLOSED_CAPTIONS, EventType.SELECT_CLOSED_CAPTION_TRACK}) public class BrightcoveClosedCaptioningController extends AbstractComponent
A controller class for managing closed captioning dialogue windows.
-
-
Field Summary
Fields Modifier and Type Field Description private final LoadCaptionsService
loadCaptionsService
private boolean
shouldImportSystemSettings
-
Constructor Summary
Constructors Constructor Description BrightcoveClosedCaptioningController(BaseVideoView videoView, Context context)
Constructor
-
Method Summary
Modifier and Type Method Description LoadCaptionsService
getLoadCaptionsService()
Method to return the LoadCaptionsService instance for fetching captions URI's. void
setShouldImportSystemSettings(boolean shouldImport)
Method to set whether to import the system caption settings before displaying captions on a video. boolean
validateCaptionSourcesField(Object obj)
Helper method to validate the types of the CAPTION_SOURCES video field,which should always be a List boolean
checkIfCaptionsExist(Video video)
Check to see if the Video passed in has closed captioning data. void
showCaptionsDialog()
Helper that prepares the captions dialog with the current state and displays the dialog over the video player. boolean
isCaptioningEnabled()
Checks the closed captioning enabled/disabled state from the applications shared preferences. void
saveClosedCaptioningState(boolean state)
Save the closed captioning enabled/disabled state to the applications shared preferences. void
setLocaleCode(String localeCode)
Stores the locale code in the default shared preferences, so itwill be persisted. void
selectCaptions(int trackIndex)
Selects the caption option and and emits the one selected. -
-
Constructor Detail
-
BrightcoveClosedCaptioningController
BrightcoveClosedCaptioningController(BaseVideoView videoView, Context context)
Constructor- Parameters:
videoView
- A video view in charge of media playback.context
- The context of the main application's activity.
-
-
Method Detail
-
getLoadCaptionsService
LoadCaptionsService getLoadCaptionsService()
Method to return the LoadCaptionsService instance for fetching captions URI's.
-
setShouldImportSystemSettings
void setShouldImportSystemSettings(boolean shouldImport)
Method to set whether to import the system caption settings before displaying captions on a video.
-
validateCaptionSourcesField
boolean validateCaptionSourcesField(Object obj)
Helper method to validate the types of the CAPTION_SOURCES video field,which should always be a List
- Parameters:
obj
- the object to test for the correct type.
-
checkIfCaptionsExist
boolean checkIfCaptionsExist(Video video)
Check to see if the Video passed in has closed captioning data.
- Parameters:
video
- The video to check
-
showCaptionsDialog
void showCaptionsDialog()
Helper that prepares the captions dialog with the current state and displays the dialog over the video player.
-
isCaptioningEnabled
boolean isCaptioningEnabled()
Checks the closed captioning enabled/disabled state from the applications shared preferences.
-
saveClosedCaptioningState
void saveClosedCaptioningState(boolean state)
Save the closed captioning enabled/disabled state to the applications shared preferences.
- Parameters:
state
- The enabled/disabled state to save.
-
setLocaleCode
void setLocaleCode(String localeCode)
Stores the locale code in the default shared preferences, so itwill be persisted.
- Parameters:
localeCode
- The two character locale code.
-
selectCaptions
void selectCaptions(int trackIndex)
Selects the caption option and and emits the one selected.Making this method public instead of protected allows for its use in custom caption dialogs
- Parameters:
trackIndex
- the caption index
-
-
-
-