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

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

Volume

Functions

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

Adds an AdPlayer.Listener callback.

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

Removes a surface previously set to render the video content.

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

Dequeue - removes a creative from the playlist.

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

Enqueue - enqueues a new URL into the player.

Link copied to clipboard
abstract fun getCurrentTime(): Double

Gets the current time.

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

Gets the duration.

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

Loads a new creative into the player.

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.

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.

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.

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

Sets a surface to render the video content.

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

Status