Captions

These API calls are used to listen to or update the active captions track if one or more closed captions tracks are provided with a video. The JavaScript API can be used to log captions usage or build your own CC menu outside JW Player. It is also possible to set caption styles dynamically using setCaptions() without having to reload the player.

Endpoints

MethodDescription
.setCaptions(styles)Changes the appearance of captions without having to reload the player. All colors should be in hex value.
.getCaptionsList()Returns an array of objects based on available captions. Information for each object may vary depending on the caption types.
.getCurrentCaptions()NA
.setCurrentCaptions(index)NA


Events

MethodDescription
.on('captionsList')Fired when the list of available captions tracks changes. This event is the ideal time to set default captions with the API.
.on('captionsChanged')Triggered whenever the active captions track is changed manually or via API.