VideoStreamPlayer

public interface VideoStreamPlayer implements ContentProgressProvider VolumeProvider

Defines a set of methods that a video player must implement to be used by the IMA SDK for dynamic ad insertion.

Nested Class Summary

interface VideoStreamPlayer.VideoStreamPlayerCallback Callbacks that the player must fire. 

Public Method Summary

abstract void
addCallback(VideoStreamPlayer.VideoStreamPlayerCallback callback)
Adds a callback so that listeners can react to events from the VideoStreamPlayer.
abstract void
loadUrl(String url, List<HashMap<String, String>> subtitles)
Loads a stream with dynamic ad insertion given the stream url and subtitles array.
abstract void
onAdBreakEnded()
The SDK will call this method the first time each ad break ends.
abstract void
onAdBreakStarted()
The SDK will call this method the first time each ad break begins playback.
abstract void
onAdPeriodEnded()
The SDK will call this method every time the stream switches from advertising or slate to content.
abstract void
onAdPeriodStarted()
The SDK will call this method every time the stream switches from content to advertising or slate.
abstract void
pause()
Pauses the current stream.
abstract void
abstract void
resume()
Resumes playing the stream.
abstract void
seek(long time)
Seeks the stream to the given time.

Inherited Method Summary

Public Methods

public abstract void addCallback (VideoStreamPlayer.VideoStreamPlayerCallback callback)

Adds a callback so that listeners can react to events from the VideoStreamPlayer.

Parameters
callback

public abstract void loadUrl (String url, List<HashMap<String, String>> subtitles)

Loads a stream with dynamic ad insertion given the stream url and subtitles array. The subtitles array is only used in VOD streams. Each entry in the subtitles array is a HashMap that corresponds to a language. Each map will have a "language" key with a two letter language string value, a "language name" to specify the set of subtitles if multiple sets exist for the same language, and one or more subtitle key/value pairs. Here's an example the map for English: "language" -> "en" "language_name" -> "English" "webvtt" -> "https://example.com/vtt/en.vtt" "ttml" -> "https://example.com/ttml/en.ttml"

Parameters
url
subtitles

public abstract void onAdBreakEnded ()

The SDK will call this method the first time each ad break ends. Applications must reenable seeking when this occurs.

public abstract void onAdBreakStarted ()

The SDK will call this method the first time each ad break begins playback. If an ad break is watched subsequent times this callback will not be triggered. Applications must disable seeking when this occurs.

public abstract void onAdPeriodEnded ()

The SDK will call this method every time the stream switches from advertising or slate to content. This will be called even when an ad is played a second time or when seeking into an ad.

public abstract void onAdPeriodStarted ()

The SDK will call this method every time the stream switches from content to advertising or slate. This will be called even when an ad is played a second time or when seeking into an ad.

public abstract void pause ()

Pauses the current stream. This may be called by the publisher or by an interactive ad.

public abstract void removeCallback (VideoStreamPlayer.VideoStreamPlayerCallback callback)

Removes a callback.

Parameters
callback

public abstract void resume ()

Resumes playing the stream. This may be called by the publisher or an interactive ad.

public abstract void seek (long time)

Seeks the stream to the given time.

Parameters
time The time to which the stream should be seeked in milliseconds.