Late-binding audio uses PTMediaPlayer to play a video that is specified in an M3U8 HLS playlist and that can contain several alternate audio streams.
Wait for the MediaPlayer to be in at least the PTMediaPlayerStatusReady
status.
Listen for this event:
notification PTMediaPlayerItemMediaSelectionOptionsAvailable
: The initial list of audio tracks is available.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onMediaPlayerItemMediaSelectionOptionsAvailable:)
name:PTMediaPlayerItemMediaSelectionOptionsAvailable
object:self.player];
Get the available audio tracks from the PTMediaPlayerItem
instance.
- (void) onMediaPlayerItemMediaSelectionOptionsAvailable:(NSNotification *) notification {
NSArray* subtitlesOptions = self.player.currentItem.subtitlesOptions;
NSArray* audioOptions = self.player.currentItem.audioOptions;
}
(Optional) Present the available tracks to the user.
Set the selected audio track on the PTMediaPlayerItem
instance.