Allow the user to change the track

Here is an example of how a user can select a closed-caption track.

  1. To display the available closed caption tracks, use the MediaPlayerItem.closedCaptionsTracks property.

    var tracks = item.closedCaptionsTracks;
    
  2. To set which closed-caption track is current, use the MediaPlayerItem.selectClosedCaptionsTrack method.

  3. 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]); 
    }
    

On this page

Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Summit Banner

A virtual event April 27-28.

Expand your skills and get inspired.

Register for free
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now
Adobe Maker Awards Banner

Time to shine!

Apply now for the 2021 Adobe Experience Maker Awards.

Apply now