StreamManager

interface StreamManager : BaseManager


An object which manages dynamic ad insertion streams. After the StreamManager is retrieved from an AdsManagerLoadedEvent, init should be called.

Summary

Public functions

Long

Converts time offset within the stream to time offset of the underlying content, excluding ads.

(Mutable)List<CuePoint!>!

Returns the CuePoints for the current VOD stream, which are available after CUEPOINTS_CHANGED is broadcast.

CuePoint?

Returns the previous cuepoint for the given VOD stream time.

String!

Get the identifier used during server side ad insertion to uniquely identify a stream.

Long

Converts time offset within the content to time offset of the underlying stream, including ads.

Unit
loadThirdPartyStream(
    streamUrl: String!,
    streamSubtitles: (Mutable)List<(Mutable)Map<String!, String!>!>!
)

Requests SDK to retrieve the ad metadata and then load the provided streamManifestUrl and streamSubtitles into player.

Unit
replaceAdTagParameters(adTagParameters: (Mutable)Map<String!, String!>!)

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

Inherited functions

From com.google.ads.interactivemedia.v3.api.player.AdProgressProvider
VideoProgressUpdate!

Returns VideoProgressUpdate describing playback progress of the current ad or VideoProgressUpdate#VIDEO_TIME_NOT_READY if video details are not yet available.

From com.google.ads.interactivemedia.v3.api.BaseManager
Unit

Registers a listener for errors that occur during the ad or stream initialization and playback.

Unit

Registers a listener for ad events that occur during ad or stream initialization and playback.

Unit

Stops the ad and all tracking, then releases all assets that were loaded to play the ad.

Unit

Generic focus endpoint that puts focus on the skip button if present.

AdProgressInfo!

Returns the latest AdProgressInfo for the current playing ad.

Ad!

Get currently playing ad.

Unit

Initializes the ad experience using default rendering settings.

Unit

Initializes the ad experience on the manager.

Unit

Removes a listener for error events.

Unit

Removes a listener for ad events.

Public functions

getContentTimeMsForStreamTimeMs

fun getContentTimeMsForStreamTimeMs(streamTimeMs: Long): Long

Converts time offset within the stream to time offset of the underlying content, excluding ads. For LIVE streams, content time is not meaningful, so there is no conversion and this will return the same value that was given.

Parameters
streamTimeMs: Long

the stream time with inserted ads (in ms).

Returns
Long

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

getCuePoints

fun getCuePoints(): (Mutable)List<CuePoint!>!

Returns the CuePoints for the current VOD stream, which are available after CUEPOINTS_CHANGED is broadcast. Returns empty list for live streams.

getPreviousCuePointForStreamTimeMs

fun getPreviousCuePointForStreamTimeMs(streamTimeMs: Long): CuePoint?

Returns the previous cuepoint for the given VOD stream time. Returns null if there is no previous cue point, or if called for a live stream. This is used to implement features like snap back in order to return the user to a skipped ad break.

Parameters
streamTimeMs: Long

the stream time (in ms).

Returns
CuePoint?

the previous CuePoint for the given stream time.

getStreamId

fun getStreamId(): String!

Get the identifier used during server side ad insertion to uniquely identify a stream. Returns null if server side ad insertion was not used.

getStreamTimeMsForContentTimeMs

fun getStreamTimeMsForContentTimeMs(contentTimeMs: Long): Long

Converts time offset within the content to time offset of the underlying stream, including ads. For LIVE streams, content time is not meaningful, so there is no conversion and this will return the same value that was given.

Parameters
contentTimeMs: Long

the content time without any ads (in ms).

Returns
Long

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

loadThirdPartyStream

fun loadThirdPartyStream(
    streamUrl: String!,
    streamSubtitles: (Mutable)List<(Mutable)Map<String!, String!>!>!
): Unit

Requests SDK to retrieve the ad metadata and then load the provided streamManifestUrl and streamSubtitles into player. This should be manually triggered 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 types.

Parameters
streamUrl: String!

the manifest url for the stream with dynamic ad insertion.

streamSubtitles: (Mutable)List<(Mutable)Map<String!, String!>!>!

the subtitles array for the stream. Detail format see VideoStreamPlayer#loadUrl.

replaceAdTagParameters

fun replaceAdTagParameters(adTagParameters: (Mutable)Map<String!, String!>!): Unit

Replaces all the ad tag parameters used for the upcoming ad requests for a live stream. Note that this call is a no-op for VOD streams.

Parameters
adTagParameters: (Mutable)Map<String!, String!>!

the new ad tag parameters to use for the current stream.