Exposing Subtitles

The PSDK notifies the player client about the availability of internal AVAsset’s availableMediaCharacteristicsWithMediaSelectionOptions through the PTMediaPlayerMediaSelectionOptionsAvailableNotification notification. The available subtitles can then be accessed through the PTMediaPlayerItem property, subtitlesOptions.

To expose subtitles:

  1. The client registers itself as a listener for the PTMediaPlayerMediaSelectionOptionsAvailableNotification notification:
    [[NSNotificationCenter defaultCenter] 
      addObserver:self selector:@selector(onMediaPlayerItemMediaSelectionOptionsAvailable:) 
      name:PTMediaPlayerMediaSelectionOptionsAvailableNotification object:self.player];
  2. When the client receives this notification, it implies that PTMediaPlayerItem has the available subtitles ready. The onMediaPlayerItemMediaSelectionOptionsAvailable method needs to be similar to this:
    - (void) onMediaPlayerItemMediaSelectionOptionsAvailable:(NSNotification *) notification {
        NSArray* subtitlesOptions = self.player.currentItem.subtitlesOptions;
        NSArray* audioOptions = self.player.currentItem.audioOptions;
    }

    See "Implementing Alternate Audio" for information about alternate audio tracks.