Skip to main content

Interactive Media Ads (IMA)

IMA SDKs simplify the process of incorporating multimedia advertisements into your web pages and applications. They can request ads from any VAST-compliant ad server and handle the playback of the ads within the app. By using the IMA client-side SDKs, you retain control of the content video playback while the SDK manages the ad playback. The ads are displayed in a separate video player that is overlaid on top of the app's content video player.

AttributeTypeRequiredDescription
enabledBooleanNoEnable the plugin (Defaults to false if no value is given.)
adTagUrlStringNoAd Tag URL of the advertisement. (VAST, VPAID, VMAP, SIMID)
liveStreamPrefetchSecondsIntNoInform IMA about when the ad should start loading before the ad shows.
Gradle dependencies
dependencies {
implementation 'androidx.media3:media3-exoplayer-ima:1.2.0'
}

VAST Example

val luraConfiguration = LuraConfiguration(
ads = LuraAdsConfiguration(
clientSide = LuraClientSideConfiguration(
provider = "gam",
gam = LuraGamConfiguration(
enabled = true,
adTagUrl = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpostpod&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator=[LURA_CORRELATOR]"
)
)
)
)

playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)

VMAP - Pre-roll Single Ad, Mid-roll Standard Pod with 3 ads, Post-roll Single Ad Example

val luraConfiguration = LuraConfiguration(
ads = LuraAdsConfiguration(
clientSide = LuraClientSideConfiguration(
provider = "gam",
gam = LuraGamConfiguration(
enabled = true,
adTagUrl = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpostpod&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator=[LURA_CORRELATOR]"
)
)
)
)

playerView = findViewById(R.id.lura_player_view)
player = LuraPlayer(context = this, playerView = playerView)
player.setConfig(luraConfiguration)