Skip to main content

Generate a Nonce for Your Ad Request

A nonce is a single encrypted string generated by PAL via the NonceLoader. The PAL SDK requires each new stream request to be accompanied by a newly generated nonce. However, nonces may be reused for multiple ad requests within the same stream.

Initialize the PAL Plugin

To initialize the PAL Plugin, add pal attribute to the plugins object in your config. To see more details about configuration, please check out PAL Plugin

val luraConfiguration = LuraConfiguration(
plugins = LuraPluginsConfigurations(
pal = PalConfiguration(
enabled = true,
allowStorageConsent = true,
ppid = "",
descriptionURL = ""
)
)
)

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

Using the PAL Nonce

LuraPlayer automatically fills the reserved macro LURA_PAL_NONCE in URL's under the ads parameter. Check out macros for more details.

val luraConfiguration = LuraConfiguration(
...
content = LuraContent(
media = listOf(
LuraMedia(
type = "video/x-mpegurl",
url = ""
)
),
id = "id",
title = "title",
type = LuraVideoType.VOD
),
ads = LuraAdsConfiguration(
clientSide = LuraClientSideConfiguration(
provider = "generic",
generic = LuraGenericConfiguration(
LuraPrerollConfiguration(
url = "https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=[LURA_CORRELATOR]&givn=[LURA_PAL_NONCE]"
)
)
)
),
plugins = LuraPluginsConfigurations(
pal = PalConfiguration(
enabled = true,
allowStorageConsent = true,
ppid = "",
descriptionURL = ""
)
)
)

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