AdsRenderingSettings

interface AdsRenderingSettings


Defines parameters that control the rendering of ads.

Summary

Public functions

Int

Returns the maximum recommended bitrate in kbit/s.

Boolean

Returns whether the click-through URL is opened using Custom Tabs feature.

Boolean

Returns whether the SDK preloads the ad creative before playback starts.

Boolean

Returns whether the SDK focuses on the skip button when the skippable ad can be skipped on Android TV.

(Mutable)List<String!>?

Returns the list of MIME types prioritized during media selection, or null if unspecified.

Unit
setBitrateKbps(bitrate: Int)

Sets the maximum recommended bitrate in kbit/s.

Unit
setEnableCustomTabs(enableCustomTabs: Boolean)

Notifies the SDK whether to launch the click-through URL using Custom Tabs feature.

Unit
setEnablePreloading(enablePreloading: Boolean)

Sets whether the SDK preloads the ad creative before playback starts.

Unit
setFocusSkipButtonWhenAvailable(enableFocusSkipButton: Boolean)

Sets whether to focus on the skip button when the skippable ad can be skipped on Android TV.

Unit
setLoadVideoTimeout(loadVideoTimeout: Int)

Specifies a non-default amount of time to wait for media to load before timing out, in milliseconds.

Unit
setMimeTypes(mimeTypes: (Mutable)List<String!>!)

Sets the prioritized MIME types during media selection.

Unit

Sets the time, in seconds, after which eligible ad breaks are played for VMAP and ad rules playlists.

Unit

Sets the ad UI elements to be rendered by the IMA SDK.

Public functions

getBitrateKbps

fun getBitrateKbps(): Int

Returns the maximum recommended bitrate in kbit/s.

getEnableCustomTabs

fun getEnableCustomTabs(): Boolean

Returns whether the click-through URL is opened using Custom Tabs feature.

getEnablePreloading

fun getEnablePreloading(): Boolean

Returns whether the SDK preloads the ad creative before playback starts.

getFocusSkipButtonWhenAvailable

fun getFocusSkipButtonWhenAvailable(): Boolean

Returns whether the SDK focuses on the skip button when the skippable ad can be skipped on Android TV.

This is a no-op on non-Android TV devices.

getMimeTypes

fun getMimeTypes(): (Mutable)List<String!>?

Returns the list of MIME types prioritized during media selection, or null if unspecified.

setBitrateKbps

fun setBitrateKbps(bitrate: Int): Unit

Sets the maximum recommended bitrate in kbit/s.

The SDK selects media which has a bitrate below the specified max or the closest bitrate if there is no media with a lower bitrate found. Default value, -1, means the SDK selects the bitrate.

Parameters
bitrate: Int

Maximum bitrate in kbit/s. Default is -1 for SDK to auto select.

setEnableCustomTabs

fun setEnableCustomTabs(enableCustomTabs: Boolean): Unit

Notifies the SDK whether to launch the click-through URL using Custom Tabs feature.

Parameters
enableCustomTabs: Boolean

Set to true if the SDK needs to open the video or companion click-through URL using Custom Tabs feature. Default is false.

setEnablePreloading

fun setEnablePreloading(enablePreloading: Boolean): Unit

Sets whether the SDK preloads the ad creative before playback starts.

If set, the SDK instructs the player to load the creative in response to init. This allows the player to preload the ad at any point before calling start.

Parameters
enablePreloading: Boolean

Set to true if the SDK needs to preload the ad. Default is false.

setFocusSkipButtonWhenAvailable

fun setFocusSkipButtonWhenAvailable(enableFocusSkipButton: Boolean): Unit

Sets whether to focus on the skip button when the skippable ad can be skipped on Android TV.

This is a no-op on non-Android TV devices.

Parameters
enableFocusSkipButton: Boolean

Set to false if the SDK need not auto focus on the skip button. Default is true.

setLoadVideoTimeout

fun setLoadVideoTimeout(loadVideoTimeout: Int): Unit

Specifies a non-default amount of time to wait for media to load before timing out, in milliseconds.

This only applies to the IMA client-side SDK. Default time is 8000 ms.

Parameters
loadVideoTimeout: Int

Time in milliseconds to wait for media load.

setMimeTypes

fun setMimeTypes(mimeTypes: (Mutable)List<String!>!): Unit

Sets the prioritized MIME types during media selection.

If specified, the SDK prioritizes the media with MIME type on the list. If not specified, the SDK picks the media based on player capabilities. This only refers to the mime types of videos to be selected for linear ads.

Parameters
mimeTypes: (Mutable)List<String!>!

MIME types to be prioritized during media selection.

setPlayAdsAfterTime

fun setPlayAdsAfterTime(time: Double): Unit

Sets the time, in seconds, after which eligible ad breaks are played for VMAP and ad rules playlists.

This setting is strictly after - for example, setting playAdsAfterTime to 15 ignores an ad break scheduled to play at 15s.

Parameters
time: Double

Time in seconds after which the eligible ad breaks are played.

setUiElements

fun setUiElements(uiElements: (Mutable)Set<UiElement!>!): Unit

Sets the ad UI elements to be rendered by the IMA SDK.

All values in the list are instances of UiElement. Some elements may be required to be displayed, or unable to be displayed for a given ad (for instance, the ad UI may be customizable for DFP direct sold ads, but not for AdSense ads). In these cases, some modifications to the uiElements list may have no effect for specific ads. As a result, you should always check getUiElements after setting uiElements.

For example, the SDK attempts to render only the ad attribution with the following code:

renderingSettings.setUiElements(ImmutableSet.of(UiElements.AD_ATTRIBUTION));
Parameters
uiElements: (Mutable)Set<UiElement!>!

Ad UI elements to be rendered by the SDK.