libbambuser  0.9.23
Instance Methods | Properties | List of all members
BambuserPlayer Class Reference

#import <libbambuserplayer.h>

Instance Methods

(id) - init
 Used to initialise the BambuserPlayer view.
 
(void) - playVideo:
 
(void) - stopVideo
 
(void) - pauseVideo
 
(void) - playVideo
 
(void) - seekTo:
 

Properties

id< BambuserPlayerDelegatedelegate
 Set this to the object that conforms to the BambuserPlayerDelegate protocol, to receive updates about playback.
 
NSString * resourceUri
 
NSString * applicationId
 
enum BroadcastState requiredBroadcastState
 
enum BambuserPlayerState status
 
NSError * error
 
BOOL canPause
 
double playbackPosition
 
BOOL live
 
CGSize resolution
 
BOOL VODControlsEnabled
 
enum VideoScaleMode videoScaleMode
 
BOOL timeShiftModeEnabled
 
double seekableStart
 
double seekableEnd
 
float volume
 The audio playback volume for the BambuserPlayer, ranging from 0.0 through 1.0 on a linear scale. More...
 
LatencyMeasurement endToEndLatency
 Get the current measured end-to-end latency when playing a live broadcast. More...
 

Detailed Description

This is the main class for using the player library. Implement the BambuserPlayerDelegate to receive callbacks from a BambuserPlayer instance. By handing BambuserPlayer a broadcast's resourceUri, it plays that broadcast. A resourceUri is a signed Uri that can be requested through the Bambuser Metadata API.

A broadcast is in a defined BambuserPlayerState. Archived broadcasts (or live broadcasts in timeshift mode) can be paused or stopped. Live broadcasts can only be stopped. If the parent application is sent to background an archived broadcast (or live broadcasts in timeshift mode) is paused and a live broadcast is stopped.

After kBambuserPlayerStateStopped or kBambuserPlayerStateError has been entered the BambuserPlayer instance is no longer usable. To start playback again create a new instance of BambuserPlayer.

Method Documentation

- (void) pauseVideo

Pauses playback of archived broadcasts or live broadcasts in timeshift mode.

For live broadcasts not in timeshift mode, a call to this method has no effect.

- (void) playVideo

Resume playback of a broadcast that has been paused. This is only available for archived or live broadcasts in timeshift mode. For live broadcasts, playback must be requested via the playVideo method.

- (void) playVideo: (NSString *)  resourceUri

Request the BambuserPlayer to start playing a broadcast with the supplied resource uri, which is a signed URI received from the Bambuser Metadata API.

This method can only be called once. Subsequent calls to this method have no effect.

Parameters
resourceUriThe resource uri associated with the broadcast to be loaded.
- (void) seekTo: (double)  time

Seek archived broadcast to supplied time (in seconds).

- (void) stopVideo

Stops and terminates playback of a broadcast. To start playback again create a new instance of BambuserPlayer.

Property Documentation

- (NSString*) applicationId
readwritenonatomicretain

Contains the Bambuser Application ID necessary to make authorized requests.

This property can only be set before calling playVideo. If set after it has no effect.

- (BOOL) canPause
readnonatomicassign

Returns YES if the BambuserPlayer has loaded an archived broadcast (or a live broadcast in timeshift mode) and is in a state that supports pause/play/seeking, NO otherwise.

- (LatencyMeasurement) endToEndLatency
readnonatomicassign

Get the current measured end-to-end latency when playing a live broadcast.

During a live broadcast, the broadcaster and BambuserPlayer can synchronize their clocks with the servers and the player can determine the current end-to-end latency.

End-to-end latency measurements may take a while before appearing and may not be available for all broadcasts, as it requires successful clock synchronization and needs to be supported by the broadcast source too.

Returns
A LatencyMeasurement struct containing the current end-to-end latency and the total uncertainty of the broadcaster and player. The LatencyMeasurement.uncertainty field is negative if end-to-end latency information currently is unavailable.
- (NSError*) error
readnonatomicassign
- (BOOL) live
readnonatomicassign

This boolean property indicates whether the broadcast loaded for playback is currently live or not. Available after status has changed from kBambuserPlayerStateLoading to kBambuserPlayerStateBuffering or kBambuserPlayerStatePlaying. The value is not updated later. Live broadcasts, unless timeShiftModeEnabled is set to YES, cannot be paused nor seeked in.

- (double) playbackPosition
readnonatomicassign

Returns the current playback position (in seconds) of the current broadcast. The current position is always available for archived broadcasts and for live broadcasts in timeshift mode. It may also be available for live broadcasts, depending on video format. Returns 0 if current position is unknown.

- (enum BroadcastState) requiredBroadcastState
readwritenonatomicassign

Set the broadcast state accepted when loading the broadcast for playback. For example, this can be used to ensure that the player will only play the provided broadcast while its status is still live, prohibiting playback of an archived file, or vice versa. Default value is kBambuserBroadcastStateAny.

This property can only be set before calling playVideo. If set after it has no effect.

- (CGSize) resolution
readnonatomicassign

Returns the original resolution of the broadcast Available after status has changed from kBambuserPlayerStateLoading to kBambuserPlayerStateBuffering or kBambuserPlayerStatePlaying. Value is not updated later. Returns (0,0) until it is known.

- (NSString*) resourceUri
readnonatomicassign

Returns the resourceUri for the currently loaded broadcast, nil if playVideo has not been called.

This value is set in playVideo: when starting playback of a broadcast.

- (double) seekableEnd
readnonatomicassign

This property holds the latest possible position to seek to in timeshift mode. This property will return a negative value if not available.

- (double) seekableStart
readnonatomicassign

This property holds the earliest possible position to seek to in timeshift mode. This property will return a negative value if not available.

- (enum BambuserPlayerState) status
readnonatomicassign

This property reflects the current state of playback.

- (BOOL) timeShiftModeEnabled
readwritenonatomicassign

This boolean property is used to enable seeking during a live broadcast. The default value is NO, as the timeshift mode has trade-offs: it adds additional latency, and is mainly suited for broadcasts with reasonable duration. This should only be enabled if seeking in live content is actually required.

This property can only be set before calling playVideo. If set after it has no effect.

- (enum VideoScaleMode) videoScaleMode
readwritenonatomicassign

An enum that specifies how the video is displayed within the bounds of the BambuserPlayer's view. The default value is VideoScaleAspectFit.

- (BOOL) VODControlsEnabled
readwritenonatomicassign

This boolean property indicates whether or not system controls should be displayed when doing playback of archived broadcasts.

- (float) volume
readwritenonatomicassign

The audio playback volume for the BambuserPlayer, ranging from 0.0 through 1.0 on a linear scale.

A value of 0.0 indicates silence; a value of 1.0 (the default) indicates full audio volume for the BambuserPlayer.

Setting this property outside the valid range of 0.0 - 1.0 will cap the volume to 0.0 or 1.0.