Class: StreamManager

Constructor

StreamManager

new StreamManager(videoElement, adUiElement, uiSettings)

Constructor.

Parameter

videoElement

The HTML video element where playback will occur.

Value must not be null.

adUiElement

Optional

The HTML element to use to hold the ad UI elements. This element should be the same height and width as the video playback, and should directly overlay it. If not provided, no UI will be shown, and no ads which require UI, such as skippable ads, will be requested.

uiSettings

Optional

The UI settings to use for this stream.

Value must not be null.

Throws

when input parameters do not fulfill requirements.

Properties

clickElement

non-null HTMLElement

clickElement

non-null HTMLElement

streamMonitor

non-null PodServingStreamMonitor

Methods

contentTimeForStreamTime

contentTimeForStreamTime(streamTime) returns number

Returns the content time without ads for a given stream time. Returns the given stream time for live streams.

Parameter

streamTime

number

the stream time with inserted ads (in seconds).

Returns

number the content time that corresponds with the given stream time once ads are removed.

focus

focus() returns void

Puts the focus on the skip button, if present. If not present, focus is put on interactive elements, including icons or interactive creatives.

Returns

void 

getAdSkippableState

getAdSkippableState() returns boolean

Returns true if the ad can currently be skipped. When this value changes, the StreamManager fires a StreamEvent.SKIPPABLE_STATE_CHANGED event.

Returns

boolean True if the ad can currently be skipped, false otherwise.

loadStreamMetadata

loadStreamMetadata() returns void

Requests SDK to load ad metadata and then broadcasts StreamEvent.LOADED. This should be manually trigger once the stream manifest has been retrieved from 3rd party video stitcher. This is only used for Pod Serving VOD with 3rd party video stitcher, and is no-op for other stream request.

Returns

void 

onTimedMetadata

onTimedMetadata(metadata) returns void

Passes in a dictionary of processed metadata. The dictionary expects the key 'TXXX' with the user-defined metadata string as the value. If your player provides raw metadata, call StreamManager.processMetadata instead.

Parameter

metadata

(null or non-null Object with string properties)

The dictionary of metadata.

Returns

void 

previousCuePointForStreamTime

previousCuePointForStreamTime(streamTime) returns (null or CuePoint)

Returns the previous cuepoint for the given stream time. Returns null if no such cuepoint exists. This is used to implement features like snap back, and called when the publisher detects that the user seeked in order to return the user to an ad break.

Parameter

streamTime

number

the stream time that was seeked to.

Returns

(null or non-null CuePoint) the previous cuepoint for the given stream time.

processMetadata

processMetadata(type, data, timestamp) returns void

Processes timed metadata for live streams. Use if your video player provides unparsed metadata along with timestamps, otherwise, call StreamManager.onTimedMetadata.

Parameter

type

string

Type for metadata. Must be 'ID3' for HLS, or the event message scheme ID URI for DASH.

data

(string or non-null Uint8Array)

Raw tag data. For ID3, must be the entire raw tag data. For DASH event messages, this is the message data string.

timestamp

number

Time in seconds when data should be processed. For DASH, this is the event message start time.

Returns

void 

replaceAdTagParameters

replaceAdTagParameters(adTagParameters) returns void

Replaces all of the ad tag parameters used for upcoming ad requests for a live stream.

Parameter

adTagParameters

Object with string properties

The new ad tag parameters. Must have string values.

Value must not be null.

Returns

void 

requestStream

requestStream(streamRequest) returns void

Requests a stream to be loaded using provided stream parameters.

Parameter

streamRequest

StreamRequest

contains parameters to load the stream metadata.

Value must not be null.

Returns

void 

reset

reset() returns void

Resets the stream manager and removes any continuous polling.

Returns

void 

setClickElement

setClickElement(clickElement) returns void

Sets the ads click through element. This element is used as the click or tap receiver while an ad is playing and may result in navigation away from the current page. This is now deprecated, and an adUiElement should be passed in to the StreamManager instead. If an adUiElement is given to the StreamManager constructor, this method becomes a no-op.

Parameter

clickElement

(null or non-null Element)

The element used as the ad click through.

Deprecated
Provide an adUiElement to the StreamManager constructor instead.
Returns

void 

streamTimeForContentTime

streamTimeForContentTime(contentTime) returns number

Returns the stream time with ads for a given content time. Returns the given content time for live streams.

Parameter

contentTime

number

the content time without any ads (in seconds).

Returns

number the stream time that corresponds with the given content time once ads are inserted.