StreamManager
Handles dynamic ad insertion streams. It manages interactions with the DAI backend and handles tracking pings as well as forwarding stream and ad events to the publisher. Integrates with the CAF API for ad UI.
Constructor
StreamManager
new StreamManager(mediaElement)
Parameter |
|
---|---|
mediaElement |
Optional The HTML media element where playback will occur. Only provide if using a custom player. |
- Throws
-
when required parameters are not supplied.
Property
streamMonitor
non-null PodServingStreamMonitor
Methods
addEventListener
addEventListener(type, listener) returns void
Adds a listener for the given event type.
Parameter |
|
---|---|
type |
string The type of event to listen for. |
listener |
function(non-null StreamEvent) A function called each time an event of this type occurs. |
- Returns
-
void
getStreamId
getStreamId() returns (null or string)
Returns the stream id for the current stream.
- Returns
-
(null or string)
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
removeEventListener
removeEventListener(type, listener) returns void
Removes a listener for the given event type. The listener function must
be equal by reference to the one previously passed to addEventListener
.
Parameter |
|
---|---|
type |
string The type of event for which to remove the listener. |
listener |
function(non-null StreamEvent) The function to remove as a listener. |
- 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(loadRequest, streamRequest) returns Promise containing (null, non-null cast.framework.messages.LoadRequestData, or non-null cast.framework.messages.ErrorData)
Requests a stream to be loaded using provided stream parameters. Populates the loadRequest with the loaded stream data.
Parameter |
|
---|---|
loadRequest |
cast.framework.messages.LoadRequestData Value must not be null. |
streamRequest |
Value must not be null. |
- Returns
-
non-null Promise containing (null, non-null cast.framework.messages.LoadRequestData, or non-null cast.framework.messages.ErrorData)
reset
reset() returns void
Resets the stream manager and removes any continuous polling.
- Returns
-
void