AdsLoader

interface AdsLoader


An object which allows publishers to request ads from ad servers or a dynamic ad insertion stream. To do so, users must register for the AdsManagerLoadedEvent event and store a reference to the returned AdsManager or StreamManager.

Summary

Nested types

Listener interface for notification of ad load or stream load completion.

Public functions

Unit

Registers a listener for errors that occur during the ads request.

Unit

Registers a listener for the ads manager loaded event.

Unit

This function is deprecated.

- Use VideoAdPlayerCallback.onContentComplete() or VideoStreamPlayerCallback.onContentComplete() instead.

ImaSdkSettings!

Returns the IMA SDK settings instance.

Unit

Frees resources from the BaseDisplayContainer as well as the underlying WebView.

Unit

Removes a listener for error events.

Unit

Removes a listener for the ads manager loaded event.

Unit
requestAds(adsRequest: AdsRequest!)

Requests ads from a server.

String!
requestStream(streamRequest: StreamRequest!)

Initiates a stream session with server-side ad insertion.

Public functions

addAdErrorListener

fun addAdErrorListener(errorListener: AdErrorEvent.AdErrorListener!): Unit

Registers a listener for errors that occur during the ads request.

addAdsLoadedListener

fun addAdsLoadedListener(loadedListener: AdsLoader.AdsLoadedListener!): Unit

Registers a listener for the ads manager loaded event.

contentComplete

fun contentComplete(): Unit

Signals to the SDK that the content is finished. This will allow the SDK to play post-roll ads, if any are loaded through ad rules.

getSettings

fun getSettings(): ImaSdkSettings!

Returns the IMA SDK settings instance. To change the settings, just call the methods on the instance. The changes will apply for all ad requests made with this ads loader.

release

fun release(): Unit

Frees resources from the BaseDisplayContainer as well as the underlying WebView. This should occur after disposing of the BaseManager using destroy and after the manager has finished its own cleanup, as indicated by ALL_ADS_COMPLETED

removeAdErrorListener

fun removeAdErrorListener(errorListener: AdErrorEvent.AdErrorListener!): Unit

Removes a listener for error events.

removeAdsLoadedListener

fun removeAdsLoadedListener(loadedListener: AdsLoader.AdsLoadedListener!): Unit

Removes a listener for the ads manager loaded event.

requestAds

fun requestAds(adsRequest: AdsRequest!): Unit

Requests ads from a server.

Parameters
adsRequest: AdsRequest!

An object containing ads request parameters. This object cannot be null. It must contain a non-null AdDisplayContainer and either an ad tag URL or an an ads response.

requestStream

fun requestStream(streamRequest: StreamRequest!): String!

Initiates a stream session with server-side ad insertion.

Parameters
streamRequest: StreamRequest!

An object containing stream request parameters. This object cannot be null, and it must contain a non-null AdDisplayContainer and asset key.

Returns
String!

the SDK-generated session ID for the current ads session, as initiated by a stream request.