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.
- Android
- iOS
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);
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
imaDAIStreamURLLoadTimeoutMs | number | No | 10000 | Maximum time in ms to wait for the DAI stream URL before playback fails. |
Friendly obstruction — lazy registration
iOS lets you register views that overlay the ad player as friendly obstructions after the player is created, using the lazy registration APIs.
// Register a view as a friendly obstruction after player creation.
await player.registerFriendlyObstruction(viewID, purpose, reason);
// Unregister all previously registered friendly obstructions.
await player.unregisterAllFriendlyObstruction();
Note:
registerFriendlyObstructionandunregisterAllFriendlyObstructionwork on iOS only. For Android, pass friendly obstructions inPlayerConfigbefore callingcreatePlayer.
For the full friendly obstruction spec, see the Google IMA OMSDK guide for iOS.
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);
AdOverlayPurpose | Description |
|---|---|
playbackControls | Controls overlaying the player. |
notVisible | Overlays that are not visible. |
closeAd | Ad close buttons overlaying the player. |
other | Other overlays. |
Note: All views registered as friendly obstructions must exist before
createPlayeris called and must not be removed from their parent view until playback ends.