Expose subtitles

The TVSDK notifies your player client about the availability of internal AVAsset’s availableMediaCharacteristicsWithMediaSelectionOptions by using the PTMediaPlayerMediaSelectionOptionsAvailableNotification notification.

You can access the available subtitles through the PTMediaPlayerItem property’s subtitlesOptions.

To expose subtitles:

  1. Register the client as a listener for the PTMediaPlayerMediaSelectionOptionsAvailableNotification notification.

    [[NSNotificationCenter defaultCenter]  
      addObserver:self selector:@selector(onMediaPlayerItemMediaSelectionOptionsAvailable:)  
      name:PTMediaPlayerMediaSelectionOptionsAvailableNotification object:self.player];
    

    When your client receives this notification, the subtitles are ready in the PTMediaPlayerItem.

  2. Implement the onMediaPlayerItemMediaSelectionOptionsAvailable method similar to the following example:

    - (void) onMediaPlayerItemMediaSelectionOptionsAvailable:(NSNotification *) notification { 
        NSArray* subtitlesOptions = self.player.currentItem.subtitlesOptions; 
        NSArray* audioOptions = self.player.currentItem.audioOptions; 
    }
    

    For information about alternate audio tracks, see Alternate Audio.

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