Class: Break

  • The cast.framework.messages.Break class represents a break, such as an ad break, within a main video and includes properties like ID, duration, and position.

  • Breaks can contain multiple break clips, indicated by their IDs in the breakClipIds property.

  • Breaks have a position property defining their location in the main video, with -1 signifying a post-roll position.

  • The isWatched property indicates whether a break has been viewed, allowing senders to visually distinguish watched breaks.

  • Breaks can be expanded on the timeline using the expanded property, affecting total playback duration calculation.

Constructor

Break

new Break(id, breakClipIds, position)

Parameter

id

string

Unique ID of a break.

breakClipIds

Array of string

List of break clip IDs included in this break.

Value must not be null.

position

number

Position of this break inside the main video.

Properties

breakClipIds

non-null Array of string

A list of break clip IDs included in this break.

duration

(number or undefined)

The duration of a break in seconds.

expanded

(boolean or undefined)

Indicates whether the break is expanded on the timeline. The duration of expanded breaks is included in the total playback duration. A value of true indicates that the break is expanded. When omitted, the value is assumed to be false.

id

string

The unique break ID. For seek breaks, the ID is an autogenerated string in a format seek-<timestampInMs>.

isEmbedded

(boolean or undefined)

Indicates whether the break is embedded in the main stream. When omitted, the value is assumed to be false.

isWatched

boolean

Whether a break was watched. This is marked as true when the break begins to play. A sender can change the color of a progress bar marker corresponding to this break once this field changes from false to true, indicating that the user has viewed the break.

position

number

The location of the break inside the main video in seconds. -1 represents the position at the end of the main video (post-roll) and is only valid for the client-side ad stitching. For the server-side ad stitching, an exact position is required.