<img src="https://img.shields.io/badge/%20-ENTERPRISE-%23B10031" style="float:left"/><br /> <img src="https://img.shields.io/badge/Android-V4-009727?logo=android" style="float:left"/>
<br />
If you have captions or subtitles for your video content, you can use the following sections to add embedded or sidecar captions to your app.
Although there are differences between the intended purposes of captions and subtitles, you use the same processes to add or to customize either type of synchronized text to your app. For simplicity, both captions and subtitles are referred to as captions in our documentation.
<br />

The JWP SDKs respect the Caption Styling accessibility preferences of a viewer. This enables your viewers to maintain their customizations while still enjoying the video experience you have created.
<br /> <hr />
## Add captions to your app
### Embedded captions
To add videos or streams with embedded captions to your app, follow the steps to create a playlist. Replace step 2 of the process with the two steps below:
Copy the URL of your video. **The video must contain CEA-608, CEA-708, or in-manifest WebVTT captions.**
Define the `
file
` property of the `PlaylisItem
` object with the URL of your video.
<br />
### Sidecar captions
Create a `
List<Caption>
` object and name it, for example, `captionTracks
`.Use `
Caption.Builder()
` to create and name a `Caption
` object for each caption track.Add the caption track URL (`
file
`) and a language label (`label
`).(Optional) If you have multiple tracks, set `
isDefault(true)
` for the default caption track.Add each caption track to `
captionTracks
`.Add `
captionTracks
` to a playlist item.
<br />
<br />
### Add captions to existing preview thumbnails
If you have existing [preview thumbnails](🔗), you should add captions to that existing `tracks
` list. Creating a new `tracks
` list for captions will cause only the most recently added `track
` to load.
The following code example illustrates how two caption `tracks
` can be added to an existing preview thumbnail setup and associated with a playlist through `PlaylistItem.Builder()
`.
<br />
<br /> <hr />
## Captions Methods and Callbacks
<br />
### Methods
Method | Description |
`List<Caption> getCaptionsList() ` | Returns a List with captions tracks from the player |
`int getCurrentCaptions() ` | Returns the index of the currently active captions track<br /><br />The captions are off if the index is `0 ` |
`setCurrentCaptions(int index) ` | Change the visible captions track to the provided index<br /><br />The index must be within the list provided by `getCaptionsList() `. |
<br />
### Callbacks
Callback | Description |
`onCaptionsList(CaptionsListEvent captionsListEvent) ` | Fired when the list of available captions tracks is updated |
`onCaptionsChanged(CaptionsChangedEvent) ` | Fired when the active captions track is changed |
<br />