Skip to main content

Google DAI

Google DAI overview​

Google Dynamic Ad Insertion (DAI) stitches ads into the content stream on the server before delivery to the client, producing a seamless broadcast-like viewing experience. The rn-qp-nxg-player SDK supports DAI for both VOD and live content on iOS and Android.


Basic playback configuration​

Use the following TypeScript configuration to enable Google DAI playback. The isSSAIEnabled flag must be true to activate DAI ad stitching.

VOD​

import { createPlayer, PlayerConfig } from '@quickplay/rn-qp-nxg-player';

const contentAuthToken = await contentAuthorizer.authorizePlayback(platformAsset);

const playerConfig: PlayerConfig = {
contentSourceID: contentAuthToken.contentSourceId,
isSSAIEnabled: contentAuthToken.isSSAIEnabled, // must be true
videoID: contentAuthToken.contentID,
};

const player = await createPlayer(playerConfig);

Live​

import { createPlayer, PlayerConfig } from '@quickplay/rn-qp-nxg-player';

const contentAuthToken = await contentAuthorizer.authorizePlayback(platformAsset);

const playerConfig: PlayerConfig = {
assetKey: contentAuthToken.assetKey,
isSSAIEnabled: contentAuthToken.isSSAIEnabled, // must be true
};

const player = await createPlayer(playerConfig);

Platform-specific configuration​

Some configuration options apply to a single platform only.

Stream URL load timeout​

On Android, the player fetches the DAI stream URL asynchronously before starting playback. Use imaDAIStreamURLLoadTimeoutMs to configure the maximum wait time.

const playerConfig: PlayerConfig = {
assetKey: '<asset-key>',
isSSAIEnabled: true,
imaDAIStreamURLLoadTimeoutMs: 10000, // milliseconds
};

const player = await createPlayer(playerConfig);
PropertyTypeRequiredDefaultDescription
imaDAIStreamURLLoadTimeoutMsnumberNo10000Maximum time in ms to wait for the DAI stream URL before playback fails.

Friendly obstructions (both platforms)​

Register views that sit on top of the ad area as friendly obstructions so OMID measurement remains accurate. This configuration applies to both Android and iOS.

const friendlyObstructions: Array<AdOverlayUIScope> = [
{
obstructionID: {
type: 'nativeID',
id: 'player-controls-overlay',
},
purpose: AdOverlayPurpose.playbackControls,
reason: 'Playback controls overlay',
},
];

const playerConfig: PlayerConfig = {
assetKey: '<asset-key>',
isSSAIEnabled: true,
friendlyObstructions,
};

const player = await createPlayer(playerConfig);
AdOverlayPurposeDescription
playbackControlsControls overlaying the player.
notVisibleOverlays that are not visible.
closeAdAd close buttons overlaying the player.
otherOther overlays.

Note: All views registered as friendly obstructions must exist before createPlayer is called and must not be removed from their parent view until playback ends.