Create an SDK instance with your content player and ad container. The default
ad player is used when createAdAdapter is omitted. Call startSession
to begin monetization. See OptiViewAdsConfig for all options;
only player and container are required.
Clean up all resources. Call when the SDK is no longer needed.
Stop monetization: stops manifest polling, break scheduling, and resets the GAM session.
Whether a session is currently active.
Start monetization for a piece of content: begins manifest polling and (if configured) GAM session initialization. Ends any previously active session first.
Merge per-name macro updates; null marks a name empty, undefined unregisters it, and
other names stay unchanged. Active GAM targeting is re-resolved via replaceAdTagParameters();
VAST URLs use new values on the next request without re-requesting an already loaded ad.
Replace the live-update layer of the asset parameters for future breaks. Highest of the
three layers, per key; it replaces the previous update (IMA replaceAdTagParameters()
semantics). Consumed by GAM pods (IMA adTagParameters) and by VAST assets (appended to
the tag URL). No-op with a warning without an active session.
Report a click on the current ad and emit adclick with its interaction.clickThrough.
Returns the destination URL, or null when no ad or click-through URL is available.
The SDK does not open the URL; your application controls navigation.
Current playback-gated ad break status; for polling when an adbreakstatus event was missed.
Current picture-in-picture status, visible media, window owner, and insertion mode. Use this snapshot to keep your player UI aligned with the SDK.
overlay (own element) or shared-element (through the content element); content behaviour and windowOwner differ between them.
which element owns the PiP window — null when there is none (web only)
Whether an ad is currently playing.
Whether the content player is in picture-in-picture. The browser reports this directly; nothing to wire up.
Unified mute state: targets whichever player is audible — the ad player during a break, the content player otherwise — and bridges into IMA for a CSAI ad (IMA manages its own audio path).
Pause content playback. No-op during a content-locking ad break.
Resume content playback. No-op during a content-locking ad break.
Seek the content stream (seconds). Blocked during breaks with controls.snapback; no-op without a session.
Skip the running ad break when the manifest's controls.skipOffset allows it. Returns
true when applied (balanced adend + adbreakend), false when suppressed (no active
break, no skip control, or before the offset). Suppression is diagnosed as
DA-AD-SKIP-SUPPRESSED. Use getAdBreakStatus for a "Skip in Ns" affordance.
Unified volume (0-1). See muted for which player is the effective target.
Subscribe to an SDK event.
Unsubscribe from an SDK event. Pass the same handler reference that was given to addEventListener; unknown handlers are ignored.
Self-contained, redacted diagnostic report (no secrets or ad-tag-parameter values).
Unsubscribe from the structured diagnostic stream.
Subscribe to the structured diagnostic stream (stable code, category, level, JSON context).
StaticversionThe SDK version, readable without constructing an instance.
Main entry point for integrating ad playback with your web video player.
Create an instance with OptiViewAdsConfig, subscribe to events, and call startSession for each piece of content. Call endSession to stop a session or destroy to release the SDK.
A default ad player is included: progressive MP4/WebM uses native video, and HLS uses HLS.js with native HLS on platforms without Media Source support. Supply createAdAdapter only to use a custom ad player.
Example