Class: BreakManager

Methods

addBreak

addBreak(breakData, breakClips, broadCastMediaStatus) returns boolean

Adds dynamic break and break clips. The break clips will be associated with the break (break.breakClipIds and break.duration will be updated according to the clips).

Parameter

breakData

cast.framework.messages.Break

Value must not be null.

breakClips

Array of non-null cast.framework.messages.BreakClip

Value must not be null.

broadCastMediaStatus

Optional

boolean

Whether CAF should check if the current break status has changed. This may not be desirable before playback begins, as the receiver may still need to add more breaks (e.g., during load complete).

Returns

boolean True if break was added successfully.

getBreakById

getBreakById(id) returns cast.framework.messages.Break

Gets current media break by id.

Parameter

id

string

Break id.

Returns

nullable cast.framework.messages.Break 

getBreakClipById

getBreakClipById(id) returns cast.framework.messages.BreakClip

Gets current media break clip by id.

Parameter

id

string

Clip id.

Returns

nullable cast.framework.messages.BreakClip 

getBreakClipCurrentTimeSec

getBreakClipCurrentTimeSec() returns number

Returns current time in sec in currently-playing break clip.

Returns

nullable number Current time in sec inside current break clip. Null, if player is not playing break clip.

getBreakClipDurationSec

getBreakClipDurationSec() returns number

Returns duration in sec of currently-playing break clip.

Returns

nullable number Duration of current break clip. Null, if player is not playing break clip.

getBreakClips

getBreakClips() returns Array of non-null cast.framework.messages.BreakClip

Gets current media break clips.

Returns

non-null Array of non-null cast.framework.messages.BreakClip 

getBreaks

getBreaks() returns Array of non-null cast.framework.messages.Break

Gets current media breaks.

Returns

non-null Array of non-null cast.framework.messages.Break 

getCreativeInfoByClipId

getCreativeInfoByClipId(breakClipId) returns cast.framework.breaks.CreativeInformation

Gets creative information associated with breakclip by id.

Parameter

breakClipId

string

Clip id.

Returns

nullable cast.framework.breaks.CreativeInformation 

getPlayWatchedBreak

getPlayWatchedBreak() returns boolean

Returns true if watched breaks should be played.

Returns

boolean 

removeBreakById

removeBreakById(breakId) returns boolean

Removes a break and associated break clips.

Parameter

breakId

string

Break Id

Returns

boolean True if break was removed successfully.

setBreakClipLoadInterceptor

setBreakClipLoadInterceptor(interceptor)

Provides an interceptor to allow developer to insert more break clips or modify current break clip before a break is started.

If interceptor is null it will reset the interceptor to default one. By default VAST fetching and parsing logic in default interceptor. So if customized interceptor is set by developer, the VAST logic will be overridden and developers should implement their own VAST fetching and parsing logic in the provided interceptor.

Parameter

interceptor

function(non-null cast.framework.messages.BreakClip, optional non-null cast.framework.breaks.BreakClipLoadInterceptorContext)

The default break clip load interceptor will return the same break clip as input.

Value may be null.

setBreakSeekInterceptor

setBreakSeekInterceptor(seekInterceptor)

Provides an interceptor for developer to specify what breaks they want to play after seek.

Parameter

seekInterceptor

function(non-null cast.framework.breaks.BreakSeekData)

Interceptor or null if developer wants to reset it to default one. The default break seek interceptor will return the closest break from the seekTo value.

Value may be null.

setPlayWatchedBreak

setPlayWatchedBreak(playWatchedBreak)

Sets a flag to control if the watched client stitching break should be played.

Parameter

playWatchedBreak

boolean

setVastTrackingInterceptor

setVastTrackingInterceptor(interceptor)

Provides an interceptor to modify VAST tracking URL before it is being sent to server. The input of the interceptor is a string of the tracking URL. The interceptor can either return a modified string of URL or a Promise of modified string of URL. The interceptor can also return null if you want to send the tracking URL by your own code instead of by CAF.

Parameter

interceptor

function(string)

An interceptor which modifies the URL before sent.

Value may be null.