Package com.castlabs.sdk.subtitles
Class SubtitlesPlugin
java.lang.Object
com.castlabs.android.Plugin
com.castlabs.sdk.subtitles.SubtitlesPlugin
This plugin provides support for extended Subtitles within the Castlabs SDK.
Before you can use this plugin, you need to register it with the
PlayerSDK
before
you initialize the SDK itself. For example:
PlayerSDK.register(new SubtitlesPlugin());
PlayerSDK.init(getApplicationContext());
Since version 4.0.2, this plugin also registers a for a SubtitlesViewComponent
to
allow access to the underlying view that shows the subtitles on screen.
If you're not using a PlayerView
, you can use the SubtitlesPlugin.SubtitlesPluginComponent
to
get access to the underlying SubtitlesView. In order to do this, create a SubtitlesView
either programmatically or by declaring it in a layout file, and
PlayerController.setComponentView(int, View)
it to the PlayerController
passing the SUBTITLES_VIEW_ID
as identifier.- Since:
- 3.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
View ID for the defaultSubtitlesView
that is used to display subtitles in the player. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetId()
boolean
Returns whether the subtitles plugin is currently enabled.void
setEnabled
(boolean enabled) Enables or disables the subtitles plugin functionality.Methods inherited from class com.castlabs.android.Plugin
init, onRemotePlay
-
Field Details
-
SUBTITLES_VIEW_ID
@IdRes public static final int SUBTITLES_VIEW_IDView ID for the defaultSubtitlesView
that is used to display subtitles in the player. This ID should be used when setting up a custom subtitles view with the player controller.
-
-
Constructor Details
-
SubtitlesPlugin
public SubtitlesPlugin()Default constructor for the SubtitlesPlugin.
-
-
Method Details
-
getId
-
isEnabled
public boolean isEnabled()Returns whether the subtitles plugin is currently enabled.- Returns:
- true if the plugin is enabled, false otherwise
-
setEnabled
public void setEnabled(boolean enabled) Enables or disables the subtitles plugin functionality.- Parameters:
enabled
- true to enable the plugin, false to disable it
-