AdPlayer

interface AdPlayer

AdPlayer is an interface that describes the functionality of our media player and should be extended to create an SDK-compatible ad player.

Types

Link copied to clipboard
interface Listener

Callbacks that the player must fire.

Link copied to clipboard
data class MetadataItem(val key: String, val value: String)

MetadataItem encapsulates one key-value item used in the onMetadata callback

Link copied to clipboard

Various player states

Properties

Link copied to clipboard
abstract var cacheAssetsHint: Boolean

Cache assets hint - the AdPlayer may or may not implement this AdManager hint.

Link copied to clipboard

Enqueue enabled hint - the AdPlayer may or may not implement this AdManager hint.

Link copied to clipboard

Is buffering while paused. Returns:
true if the player buffers the content while paused and starts from that same point when it resumes;
false if the player does not buffer while paused, and when it resumes the playback starts from the live frame of the stream

Link copied to clipboard
abstract val name: String

Name of the player, e.g. MyExternalImplementationOfAdPlayer

Link copied to clipboard

Player capabilities as described in the VAST 4.0 document

Link copied to clipboard
Link copied to clipboard
abstract val version: String

Player version, e.g. 1.0.0

Link copied to clipboard
abstract var volume: Float

return Current player volume. The value will be between 0.0f and 1.0f

Functions

Link copied to clipboard
abstract fun addListener(listener: AdPlayer.Listener)

Adds an AdPlayer.Listener callback.
listener: AdPlayer.Listener callback to be add

Link copied to clipboard
open fun clearVideoSurface(surface: Surface)

Removes a surface previously set to render the video content.
surface - the surface that was used to render the video content

Link copied to clipboard
open fun dequeue(index: Int)

Dequeue - removes a creative from the playlist.
index - the position from which we want to remove the creative

Link copied to clipboard
open fun enqueue(creativeUrlString: String, index: Int)

Enqueue - enqueues a new URL into the player.
creativeUrlString - the url we want to enqueue
index - the position on the playlist we want to enqueue it on.

Link copied to clipboard
abstract fun getCurrentTime(): Double

Gets the current time. return the current playback time in seconds

Link copied to clipboard
abstract fun getDuration(): Double?

Gets the duration. return the current track duration in seconds

Link copied to clipboard
abstract fun load(creativeUrlString: String)

Loads a new creative into the player.
creativeUrlString - the url we want to load

Link copied to clipboard
abstract fun pause()

Pauses the current ad.

Link copied to clipboard
abstract fun play()

Plays the current ad.

Link copied to clipboard
open fun release()

This method will be called when any instance of: AdManager, AdswizzAdStreamManager, AdswizzAdPodcastManager wants to free up the resources used is their lifecycle.

Link copied to clipboard
abstract fun removeListener(listener: AdPlayer.Listener)

Removes an AdPlayer.Listener callback.
listener: AdPlayer.Listener callback to be removed

Link copied to clipboard
abstract fun reset()

Resets the player. Should be able to rerun ads from the beginning.

Link copied to clipboard
abstract fun seekTo(position: Double)

Skips to a certain position.
position: where to jump player playhead

Link copied to clipboard
abstract fun seekToTrackEnd()

Skips the current ad.

Link copied to clipboard
open fun setVideoState(videoState: AdVideoState?)

Sets the video view state for viewability purposes.
videoState - the state of the video view. Possible values: MINIMIZED, COLLAPSED, NORMAL, EXPANDED, FULLSCREEN

Link copied to clipboard
open fun setVideoSurface(surface: Surface)

Sets a surface to render the video content.
surface - the surface to be used to render the video content

Link copied to clipboard
abstract fun status(): AdPlayer.Status

return the current status for a player. The enum with all possible values is defined here: Status