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.

let palConfig = PalPluginConfiguration(ppid: "Your PPID",
descriptionUrl: "Your description URL")

Get a nonce using the PAL Plugin

After initializing the PAL Plugin, you can get a nonce by getNonce() method from PAL Plugin.

Swift
aktaPlayer.pal.getNonce()

Note that the nonce generation is handled automatically in PAL Plugin. If you want to refresh the nonce, you can refresh the nonce by refreshNonce() method from PAL Plugin.

Swift
aktaPlayer.pal.refreshNonce()