TritonPlayer Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | TritonPlayer.h |
Overview
TritonPlayer handles the playback of stations provided by Triton Digital. It also supports receiving CuePoint events with metadata for track information, ads etc.
Querying player information
state
The current state of the player
@property (readonly) TDPlayerState stateDeclared In
TritonPlayer.h
playbackDuration
Returns the current playback duration in seconds. Not available for live streams.
@property (readonly) NSTimeInterval playbackDurationDeclared In
TritonPlayer.h
currentPlaybackTime
Returns the current playback position in seconds.
@property (readonly) NSTimeInterval currentPlaybackTimeDeclared In
TritonPlayer.h
isExecuting
Tells whether the player is streaming audio.
@property (readonly) BOOL isExecutingDeclared In
TritonPlayer.h
error
When the player’s state is kTDPlayerStateError, this property contains the associated error. It’s nil for all other states.
@property (readonly) NSError *errorDeclared In
TritonPlayer.h
– getAudioQueue
The underlying audio queue which playbacks the audio. Use this when you need to process or analyze the audio data. Ex. When building a spectrum analyzer.
- (AudioQueueRef)getAudioQueueReturn Value
The underlying AudioQueue
Declared In
TritonPlayer.h
– getLibVersion
Returns the current library version
- (NSString *)getLibVersionReturn Value
A string containing the current library version.
Declared In
TritonPlayer.h
– isNetworkReachable
Informs if the network is available.
- (BOOL)isNetworkReachableReturn Value
Whether the network is available.
Declared In
TritonPlayer.h
Location targeting
targetingLocation
The most recent user location available for audience targeting.
@property (readonly) CLLocation *targetingLocationDeclared In
TritonPlayer.h
Handling interruptions
shouldResumePlaybackAfterInterruption
When an interruption ends (phone call, alarm, siri etc.) this flags will be true when it is appropriate to resume playback without waiting for user input.
@property (readonly) BOOL shouldResumePlaybackAfterInterruptionDiscussion
If the user ignored a call, it means that he/she wants to continue listening to the app and the flag will be YES. On the other side, if the interruption was caused by the Music app or other audio app being executed, it means that he/should explicitly play again to continue listening to the stream and the flag will retur NO.
Declared In
TritonPlayer.h
Creating a TritonPlayer
– initWithDelegate:andSettings:
Instantiate a new player using the specified settings
- (id)initWithDelegate:(id<TritonPlayerDelegate>)inDelegate andSettings:(NSDictionary *)settingsParameters
inDelegate |
The delegate for handling stream callbacks and CuePoint events |
|---|---|
settings |
A NSDictionary containing station parameters. |
Declared In
TritonPlayer.h
Updating player settings
– updateSettings:
Update player settings. All the information passed overrides the current settings and will take effect the next time the play method is called.
- (void)updateSettings:(NSDictionary *)settingsParameters
settings |
A NSDictionary containing station parameters. |
|---|
Discussion
When changing to a new station, this method must be called before calling play on the new station.
Declared In
TritonPlayer.h
Reproduction flow
– play
Plays the current stream with the configuration from the settings dictionary.
- (void)playSee Also
Declared In
TritonPlayer.h
– pause
Pauses the current stream. In case of a live stream, it’s the same as calling stop.
- (void)pauseDeclared In
TritonPlayer.h
– seekToTimeInterval:
Moves the cursor to the specified time interval. Only works if the media is seekable.
- (void)seekToTimeInterval:(NSTimeInterval)intervalParameters
interval |
A time interval representing the time elapsed since the start of the audio |
|---|
Declared In
TritonPlayer.h
– seekToTime:completionHandler:
Moves the cursor to the specified time and invokes the block specified when the seek operation has either been completed or been interrupted. Only works if the media is seekable.
- (void)seekToTime:(CMTime)time completionHandler:(void ( ^ ) ( BOOL finished ))completionHandlerParameters
time |
A CMTime representing the time elapsed since the start of the audio |
|---|---|
completionHandler |
The block to be executed when the seek operation has been completed or interrupted. |
Declared In
TritonPlayer.h
Controlling the volume
– setVolume:
Set volume of current playing audio
- (void)setVolume:(float)volumeParameters
volume |
a float between 0-1. |
|---|
Declared In
TritonPlayer.h
– getCastStreamingUrl
Return the stream URL for Cast Devices
- (NSString *)getCastStreamingUrlDeclared In
TritonPlayer.h
– getSideBandMetadataUrl
Return the Side Band Metadata URL
- (NSString *)getSideBandMetadataUrlDeclared In
TritonPlayer.h