Control closed-caption visibility

The PSDK provides methods to control the visibility of closed-caption data.

  1. To get the current visibility status of a closed-caption track, use the getter method to return an instance of MediaPlayer.Visibility.
    Visibility getCCVisibility() throws IllegalStateException;
    
    The MediaPlayer.Visibility enumeration defines the possible states for the closed-caption track visibility.
    enum Visibility { 
    VISIBLE, 
    INVISIBLE}
    
  2. To control the visibility of a closed-caption track on the screen, use the setter method, passing an instance of MediaPlayer.Visibility. For example:
    mediaPlayer.setCCVisibility(Visibility.VISIBLE);
    
  3. To set which closed-caption track is current, use the MediaPlayerItem.selectClosedCaptionsTrack method.
  4. Retrieve the media player item from the media player, once it is prepared, using the MediaPlayer.getCurrentItem method.
    For example:
    // Select the initial CC track.
    List<ClosedCaptionsTrack> ccTracks =
    mediaPlayer.getCurrentItem().getClosedCaptionsTracks();
    for (int i = 0; i < ccTracks.size(); i++) {
    ClosedCaptionsTrack track = ccTracks.get(i);
    if (track.getName().equals(INITIAL_CC_TRACK)) {
    mediaPlayer.getCurrentItem().selectClosedCaptionsTrack(track);
     selectedClosedCaptionsIndex = i;
    }