# TDSBMPlayer Class Reference

Inherits from | NSObject
Declared in | TDSBMPlayer.h

## Overview

Sideband Metadata (SBM) is a metadata transport mechanism offered to players that are unable to use metadata multiplexed into the stream itself (as with FLV, SHOUTcast V1/V2, etc.), either because it is impossible, difficult, or resource-intensive.

TDSBMPlayer handles the connection/play/stop flow and the reception of cue points using Triton’s Side-Band Metadata technology. If also provides synchronization facilities with the user’s audio player.

When using TDSBMPlayer, the developer is responsible of connecting and playing the main audio stream, this includes adding audience targeting parameters when connecting to the stream and also the responsibility of closing the SBM player when the main audio connection drops. To a more high-level approach, use TritonPlayer, which handles automatically audience targetting and the metadata connection.

## Managing the delegate

### `delegate`

The delegate responsible for handling callbacks

`@property (weak, nonatomic) id<TDSBMPlayerPlayerDelegate> delegate`

#### Declared In

`TDSBMPlayer.h`

## Playback information

### `currentPlaybackTime`

The time in seconds from the beginning of playback

`@property (assign, readonly) NSTimeInterval currentPlaybackTime`

#### Declared In

`TDSBMPlayer.h`

## Stream synchronization

### `synchronizationOffset`

Defines a difference in seconds between this SBMPlayer’s currentPlaybackTime and the media player’s current playback time (playhead position).

`@property (assign, nonatomic) NSTimeInterval synchronizationOffset`

#### Discussion

Cue points delivered by the TDSBMPlayer are synchronized with the side-band metadata current playback time by default. Depending on the time it takes to instantiate the application’s media player and the companion TDSBMPlayer, there can be a time offset between both.

#### Declared In

`TDSBMPlayer.h`

### `autoSynchronizeCuePoints`

Whether or not to let TDSBMPlayer synchronize the cue points automatically with it’s currentPlaybackTime and synchronizationOffset.

`@property (assign, nonatomic) BOOL autoSynchronizeCuePoints`

#### Discussion

If you need to have more fine-grained control over the synchronization, you can set it to NO and the cue points will arrive some seconds in advance and you will be able to enqueue and dequeue them based on their [CuePointEvent timestamp] property. This is usually done with help of a timed event from the media player.

Default value is YES.

#### Declared In

`TDSBMPlayer.h`

## Utility methods

### `+ generateSBMSessionId`

Utility method for creating a new sbmid session id to be shared between the audio player and the TDSBMPlayer

`+ (NSString *)generateSBMSessionId`

#### Return Value

a NSString representing a Type 4 (i.e. random) UUID, formatted as a lowercase hex string, such as: fde807eb-6931-47db-a758-9c3b0c7e84d5

#### Declared In

`TDSBMPlayer.h`

## Instantiating and configuring a player

### `– initWithSettings:`

Initializes a TDSBMPlayer with settings.

`- (instancetype)initWithSettings:(NSDictionary *)settings`

#### Parameters

`settings` | A NSDictionary containing the SBM settings. See constants in TDSBMPlayer.h for possible keys.

#### Declared In

`TDSBMPlayer.h`

### `– updateSettings:`

Update the SBM 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 *)settings`

#### Parameters

`settings` | A NSDictionary containing the SBM settings. See constants in TDSBMPlayer.h for possible keys.

#### Declared In

`TDSBMPlayer.h`

## Controlling the player

### `– play`

Start playing the Side-band metadata player

`- (void)play`

#### Declared In

`TDSBMPlayer.h`

### `– stop`

Stop playing the Side-band metadata player

`- (void)stop`

#### Declared In

`TDSBMPlayer.h`

### `– close`

Close the metadata connection.

`- (void)close`

#### Declared In

`TDSBMPlayer.h`