The subtitle strategy interface
Methods
# getCurrentSubtitle() → {Promise.<SubtitleObject>}
To get the current subtitle
Promise returning SubtitleObject object.
Promise.<SubtitleObject>
# getSubtitles() → {Promise.<Array.<SubtitleObject>>}
To get the subtitle info
Promise returning array of SubtitleObject objects.
Promise.<Array.<SubtitleObject>>
# hideSubtitle() → {Promise.<Boolean>}
To hide the subtitle
Promise returning the result of the action
Promise.<Boolean>
# prepare(player, subtitleOptionopt) → {Promise}
To prepare the subtitles, it will load the strategies and prepare them
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
player |
interfaces/Player
|
the player |
|
subtitleOption |
Array.<SubtitleObject>
|
<optional> |
Array of external subtitles |
Native Promise.
Promise
# showSubtitle(id) → {Promise.<Boolean>}
To show the subtitle by id
Parameters:
Name | Type | Description |
---|---|---|
id |
String
|
the subtitle id |
Promise returning the result of the action
Promise.<Boolean>
Type Definitions
Object
# SubtitleObject
Subtitle Object definition. Used on the subtitle methods and the initialization of the player for external subtitles. Based on Text Track from HTML5 https://developer.mozilla.org/en-US/docs/Web/API/TextTrack
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
id |
String
|
Index of the subtitle track. |
|
mimetype |
webvtt
|
imsc1
|
srt
|
sami
|
ttml
|
<optional> |
Mime type of the subtitle. Mandatory for external subtitles |
type |
String
|
<optional> |
Deprecated. Mime type of the subtitle. |
location |
String
|
<optional> |
Embebd or external. |
lang |
String
|
<optional> |
Deprecated. Language associated to the subtitle. |
language |
String
|
<optional> |
Language associated to the subtitle. |
url |
String
|
<optional> |
Mandatory for external subtitles. It should be a full accesible url and not relative. |
tag |
String
|
<optional> |
Deprecated. Label to shown on the UI. |
label |
String
|
<optional> |
Label to shown on the UI. |