<OOAudioTrackSelectionProtocol > Protocol Reference

This protocol defines all the required methods to manage audio tracks for an asset. More...

#import <OOAudioTrackSelectionProtocol.h>

+ Inheritance diagram for <OOAudioTrackSelectionProtocol >:

Instance Methods

(NSArray *) - availableAudioTracks
 Searchs for all of the audio tracks for the current asset. More...
 
(id< OOAudioTrackProtocol >) - selectedAudioTrack
 Gets the currently selected (loaded) audio track. More...
 
(void) - setAudioTrack:
 Requests the player to change the current audio track to the one provided as a parameter. More...
 
(id< OOAudioTrackProtocol >) - defaultAudioTrack
 Gets the default audio track from manifest. More...
 

Detailed Description

This protocol defines all the required methods to manage audio tracks for an asset.

Method Documentation

- (NSArray * OOAudioTrackSelectionProtocol) availableAudioTracks

Searchs for all of the audio tracks for the current asset.

It requires that a video has already loaded.

The following code snippet shows an example of this method. It assumes you are listening to the events of the OOOoyalaPlayer using notifications:

// assumes you are observing OOOoyalaPlayer notifications and you have a property
// like `@property OOOoyalaPlayer *player;`
if ([notification.name isEqualToString:OOOoyalaPlayerStateChangedNotification]) {
NSNumber *state = notification.userInfo[@"newState"];
if (state.intValue == OOOoyalaPlayerStateReady) {
NSLog(@"available audio tracks: %@", [self.player availableAudioTracks]);
}
}
Returns
NSArray of OOAudioTrackProtocol objects. It could be empty if no audio tracks were found.
- (id<OOAudioTrackProtocol> OOAudioTrackSelectionProtocol) defaultAudioTrack

Gets the default audio track from manifest.

Returns
An OOAudioTrackProtocol object or nil if nothing was found
- (id <OOAudioTrackProtocol> OOAudioTrackSelectionProtocol) selectedAudioTrack

Gets the currently selected (loaded) audio track.

It requires that a video has already loaded.

The following code snippet shows an example of this method. It assumes you are listening to the events of the OOOoyalaPlayer using notifications:

// assumes you are observing OOOoyalaPlayer notifications and you have a property
// like `@property OOOoyalaPlayer *player;`
if ([notification.name isEqualToString:OOOoyalaPlayerStateChangedNotification]) {
NSNumber *state = notification.userInfo[@"newState"];
if (state.intValue == OOOoyalaPlayerStateReady) {
NSLog(@"selected audio track: %@", [self.player selectedAudioTrack].name);
}
}
Returns
an OOAudioTrackProtocol object or nil if nothing was found.
- (void OOAudioTrackSelectionProtocol) setAudioTrack: (id< OOAudioTrackProtocol >)  audioTrack

Requests the player to change the current audio track to the one provided as a parameter.

It requires that a video has already loaded.

The following code snippet shows an example of this method. It assumes you are listening to the events of the OOOoyalaPlayer using notifications:

// assumes you are observing OOOoyalaPlayer notifications and you have a property
// like `@property OOOoyalaPlayer *player;`
if ([notification.name isEqualToString:OOOoyalaPlayerStateChangedNotification]) {
NSNumber *state = notification.userInfo[@"newState"];
if (state.intValue == OOOoyalaPlayerStateReady) {
NSArray *audioTracks = [self.player availableAudioTracks];
// lets assume audio tracks array has 2 different tracks and we want to select the second one
[self.player setAudioTrack:audioTracks[1]];
}
}
Parameters
audioTrackOOAudioTrackProtocol to be used. If the supplied OOAudioTrackProtocol isn't part of the current video asset nothing will happen.

The documentation for this protocol was generated from the following file: