Multi language caption support. This allows you to load in multiple captions and display them.

Methods

Captions(di)

Item Value
Scope Constructor
Returns Captions

Parameters

Parameter Description
Object di DI object

Initialise the captions plugin.


Properties

loaded

Item Value
Scope public
Returns Object

current language loaded

{
    caption_id: "cn9Cwym",
    title: "Ali's Test",
    language: "en-GB"
}

availableLanguages

Item Value
Scope public
Returns Array

all of the languages available

[
    {
        caption_id: "cn9Cwym",
        title: "Ali's Test",
        language: "en-US"
    },
    {
        caption_id: "cnBsjmq",
        title: "English Captions",
        language: "en-GB"
    }
]

enabled

Item Value
Scope public
Returns Boolean

Are captions enabled or disabled


Events

captionsPluginInitialised

Fired on plugin being initialised


captionsPluginReady

Fired on plugin being ready to interact with


captionsEnabled

fired on Captions.enable()


captionsDisabled

fired on Captions.disable()


captionsLoaded

fired when a new language is loaded on Captions.load(captionId)

{
    language:en-GB,
    captionId:234
}

captionsCuepoint

fired when hitting a cuepoint

{
    timecode:2893,
    language:en-GB,
    captionId:234
}

Listeners

timeupdate

It listens to the Video.timeupdate event so it can sync the captions


loadCaptions

Parameters

Parameter Description
String captionId The id for the caption you want to load

Load the captions for a particular language. You can retrieve a list of available language codes using the property Captions.availableLanguages

{
    captionId: 'csdf4'
}

enableCaptions

enable captions if available.


disableCaptions

disable captions, they will no longer show