StreamManager

public interface StreamManager extends BaseManager


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

Summary

Public methods

abstract long

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

abstract List<CuePoint>

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

abstract @Nullable CuePoint

Returns the previous cuepoint for the given VOD stream time.

abstract String

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

abstract long
getStreamTimeMsForContentTimeMs(long contentTimeMs)

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

abstract void
loadThirdPartyStream(
    String streamUrl,
    List<Map<StringString>> streamSubtitles
)

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

abstract void

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

Inherited methods

From com.google.ads.interactivemedia.v3.api.player.AdProgressProvider
abstract 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
abstract void

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

abstract void

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

abstract void

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

abstract void

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

abstract AdProgressInfo

Returns the latest AdProgressInfo for the current playing ad.

abstract Ad

Get currently playing ad.

abstract void

Initializes the ad experience using default rendering settings.

abstract void

Initializes the ad experience on the manager.

abstract void

Removes a listener for error events.

abstract void

Removes a listener for ad events.

Public methods

getContentTimeMsForStreamTimeMs

abstract long getContentTimeMsForStreamTimeMs(long streamTimeMs)

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
long streamTimeMs

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

abstract List<CuePointgetCuePoints()

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

getPreviousCuePointForStreamTimeMs

abstract @Nullable CuePoint getPreviousCuePointForStreamTimeMs(long streamTimeMs)

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
long streamTimeMs

the stream time (in ms).

Returns
@Nullable CuePoint

the previous CuePoint for the given stream time.

getStreamId

abstract String getStreamId()

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

abstract long getStreamTimeMsForContentTimeMs(long contentTimeMs)

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
long contentTimeMs

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

abstract void loadThirdPartyStream(
    String streamUrl,
    List<Map<StringString>> streamSubtitles
)

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
String streamUrl

the manifest url for the stream with dynamic ad insertion.

List<Map<StringString>> streamSubtitles

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

replaceAdTagParameters

abstract void replaceAdTagParameters(Map<StringString> adTagParameters)

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
Map<StringString> adTagParameters

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