Ads
DAI server-side ad breaks, CSAI pre-roll, targeting and consent.
Ads are served by Google Ad Manager through the Google IMA SDK family (ADR 0003): DAI for live ad breaks, CSAI for pre-roll. Both sit behind the Ads port, and both fail open — any ad/SDK error results in content playback, never a black screen.
DAI ad breaks
Pass a DAI asset key to load the ad-stitched stream instead of src (which becomes
the fail-open fallback). Google stitches the ad pods into the live stream server-side
and resolves SCTE-35 signals for you; the player surfaces breaks via the
ad events, shows an "Ad" + countdown overlay, and locks controls
during a break.
<LivePlayer
src="https://example.com/live/content.m3u8" // fail-open fallback
ads={{ assetKey: "your-dai-asset-key" }}
onEvent={(e) => {
if (e.type === "adbreakstart") pauseOtherMedia();
if (e.type === "adbreakend") resumeOtherMedia();
}}
/>CSAI pre-roll
The only client-side ad type in use: a pre-roll played before live content starts, on
some livestreams. Configure a VAST tag; skipOffset (seconds) makes it skippable.
<LivePlayer
src={src}
preroll={{ tagUrl: VAST_TAG_URL, skipOffset: 5 }}
startMode="click-to-play" // gives IMA the gesture for an unmuted pre-roll
/>With startMode="muted-autoplay" (the default) the pre-roll plays muted; with
click-to-play the user's gesture allows audio.
Targeting and consent
adConfig is forwarded verbatim into both the DAI and CSAI ad requests — the player
implements no CMP:
interface AdTargeting {
keyValues?: Record<string, string | string[]>; // GAM cust_params
gpp?: string; // IAB GPP consent string
gppSid?: string; // GPP applicable section IDs, e.g. "7" or "2,6"
usPrivacy?: string; // IAB US Privacy (CCPA) string
ppid?: string; // Publisher-provided identifier (NewsPassID)
}Never point dev/test at production ad serving (ADR 0007). Tests and demos use Google's public sample DAI asset key and sample VAST tags only. Ad-break behavior is driven through the injectable Ads port in automated tests — real GAM traffic would pollute reporting and can be flagged as invalid.
The demo on this site follows that rule — it ships Google's public sample asset key and a sample skippable VAST tag.