BaseDisplayContainer

interface BaseDisplayContainer

Known direct subclasses
AdDisplayContainer

A container in which to display the ads.

StreamDisplayContainer

A display container specific to server-side ad insertion.


A base class for more specialized container interfaces. The SDK-owned ad UI will be displayed within the container. Companion ads will be placed in the companion slots. Subclasses are responsible for displaying any additional media (linear ads, streams, etc.).

Summary

Public functions

Unit

This function is deprecated.

- This method is redundant once users are using release.

ViewGroup!

Returns the previously set container, or null if none has been set.

(Mutable)Collection<CompanionAdSlot!>!

Gets the companion slots that have been set.

Unit

Registers a view that overlays or obstructs this container as "friendly" for viewability measurement purposes.

Unit
registerVideoControlsOverlay(videoControlsOverlay: View!)

This function is deprecated.

- Use registerFriendlyObstruction instead.

Unit

This function is deprecated.

Use the constructor which determines the Ad Container at construction time.

Unit

Sets slots for displaying companions.

Unit

Unregisters all previously registered friendly obstructions.

Unit

This function is deprecated.

- Use unregisterAllFriendlyObstructions instead.

Public functions

destroy

fun destroy(): Unit

Releases resources attached to the container. This will invalidate the container and remove all views attached to it. Should be called when the associated AdsLoader is no longer needed.

getAdContainer

fun getAdContainer(): ViewGroup!

Returns the previously set container, or null if none has been set.

getCompanionSlots

fun getCompanionSlots(): (Mutable)Collection<CompanionAdSlot!>!

Gets the companion slots that have been set. Returns an empty list if none have been set.

registerFriendlyObstruction

fun registerFriendlyObstruction(friendlyObstruction: FriendlyObstruction!): Unit

Registers a view that overlays or obstructs this container as "friendly" for viewability measurement purposes.

See Open Measurement in the IMA SDK for guidance on what is and what is not allowed to be registered.

Parameters
friendlyObstruction: FriendlyObstruction!

An obstruction to be marked as "friendly" until unregistered.

registerVideoControlsOverlay

fun registerVideoControlsOverlay(videoControlsOverlay: View!): Unit

Registers video playback controls that will overlay this container. WARNING: It is critical that video controls obscure as little ad space as possible so that viewability measurement isn't impacted.

Parameters
videoControlsOverlay: View!

Small or mostly transparent video controls overlay.

setAdContainer

fun setAdContainer(container: ViewGroup!): Unit

Sets the ViewGroup in which linear UI will be displayed.

setCompanionSlots

fun setCompanionSlots(companionSlots: (Mutable)Collection<CompanionAdSlot!>?): Unit

Sets slots for displaying companions. Passing null will reset the container to having no companion slots.

unregisterAllFriendlyObstructions

fun unregisterAllFriendlyObstructions(): Unit

Unregisters all previously registered friendly obstructions.

unregisterAllVideoControlsOverlays

fun unregisterAllVideoControlsOverlays(): Unit

Unregisters all previously registered video controls overlays.