Close Captioning JavaScript APIs enable you to get supported closed captions, set close caption languages, and get the caption timing.
The following table describes all the JavaScript properties that are associated with close captioning.
Property | Description |
---|---|
getCurrentItemClosedCaptionsLanguages | Get a list of supported closed captions languages for the currently playing item. This list is derived from the closed captions XML file for this content, uploaded via Backlot. If there is no such file, this method returns an empty list. Type: List Return Values: A list in the form of "language code":"displayName". Example: { "en": "English",... }. Note: This method will throw an exception if no Closed Captions file has been uploaded for the current embed code. |
setClosedCaptionsLanguage |
Sets the language of the closed captions that will be shown in the player. Parameter: language Valid Values: Specify ISO 639-1 language code | none. For Chinese, you should use "zh-hans" for Simplified Chinese and "zh-hant" for Traditional Chinese. To show no closed captions, set the language to "none". Examples: en, de, ja. Exception: This method will throw an exception if no Closed Captions file has been uploaded for the current embed code. |
The following table describes all the JavaScript functions that are associated with close captioning.
Function | Description |
---|---|
getTimedText(startTime, endTime) | Returns the timed text (captions and caption formatting information) which appear between the startTime and endTime. Type: String Return Value: alphanumeric caption and caption information. Valid Values: Specify the startTime and endTime in seconds. |
The following list provides links to Backlot documentation that provides some general information about closed captions.