OptiViewAds
The OptiView Ads SDK entry point: one instance per content player, living as long as the player. It polls the Break Manifest of the current session, schedules the breaks against the player's timeline through the configured PlayerAdapter, plays them through the AdRenderer, and reports what happens on the event stream (addEventListener) and the diagnostics stream (onDiagnostic, exportDiagnostics).
Typical use: construct it once with an OptiViewAdsConfig and the Android runtime's OverlayAdRenderer, startSession for each piece of content, endSession when the content stops, and destroy when the player goes away.
Parameters
Fixed configuration for the lifetime of the instance.
Plays the ads; the Android runtime's OverlayAdRenderer.
Fetches and polls the Break Manifest; normally HttpManifestSource.
Drives break scheduling; normally CoroutineSchedulerTicker.
The coroutine scope the SDK works in; the default is fine for apps.
The time source; the default is the system clock (tests inject a fake).
Constructors
Functions
Subscribe to an SDK event.
Report a click on the ad currently on screen and emit the public adclick event carrying the asset's declared interaction.clickThrough URL (if any). Called by the renderer on a viewer tap, or programmatically by the application (e.g. a custom "visit advertiser" button). The SDK deliberately does NOT open the URL — that is the application's decision. Returns the clickThrough URL when a click was registered, null otherwise. Mirrors the web/iOS clickAd().
Stop monetization for the current content.
Produce a self-contained, redacted diagnostic report for support / AI tooling.
The current ad-break status snapshot, the same one AdBreakStatusEvent carries.
What the SDK currently has on the player surface — see PresentationState.
Whether an ad is currently playing.
Whether the content player is in picture-in-picture — as observed by the renderer's own Activity watcher, or as last reported through setPictureInPicture where that watcher could not attach.
Whether a session is currently active.
Unsubscribe from the structured diagnostic stream.
Subscribe to the structured diagnostic stream.
Unsubscribe from an SDK event.
Tell the SDK whether the content player is in picture-in-picture.
Skip the in-progress ad break, honoring the manifest's skip policy: the break must declare controls.skipOffset and at least that many seconds of the break must have elapsed. Returns true when the skip was applied (the break cuts to content, emitting the balanced adend + adbreakend), false when suppressed (no active break, no skip control, or before the offset). Use getAdBreakStatus to drive a "Skip in Ns" affordance. Mirrors the web/iOS skipAd().
Start monetization for a piece of content. Begins manifest polling and (if configured) GAM session init. Ends any previously active session first.
Merge macros into the asset-parameter macros of the active session. Each name replaces the previous value for that name; other names stay. A null value removes the customer macro so the built-in $OPTIVIEW_* value (if any) applies again. When a GAM stream is active the effective ad tag parameters are resolved again and pushed to IMA; VAST tag URLs use the new values on the next ad request. No-op (with a warning) without an active session.
Merge explicit-value asset-parameter macros into the active session. A callback returning com.dolby.optiview.ads.core.AssetParameterMacroValue.Empty omits the containing parameter (or cust_params pair); a null entry removes the customer macro.
Replace the live-update layer of the asset parameters on the active session. Applies to future ad breaks — no re-initialization needed.