Here is an example of how a user can select a closed-caption track.
To display the available closed caption tracks, use the MediaPlayerItem.closedCaptionsTracks
property.
var tracks = item.closedCaptionsTracks;
To set which closed-caption track is current, use the MediaPlayerItem.selectClosedCaptionsTrack
method.
After the media player item is prepared, retrieve it from the media player by using the MediaPlayer. currentItem
method.
// Select the cc track with index k.
var item = mediaPlayer.currentItem;
var tracks = item.closedCaptionsTracks;
if (k >= 0 && k < tracks.length) {
item.selectClosedCaptionsTrack(tracks[k]);
}