Optionaloptions: Partial<AdControllerImplOptions>ReadonlylogA string prefix for all log statements made by this target.
The ad currently playing within the active break, or null.
The ad break currently containing the playhead, or null when the playhead is in primary content.
The ad breaks known for the current media.
Dispatches an event.
The key of the event within EventMap
If the passed event is read-only, then it may be re-used/cached. Otherwise, it should be a new event object every dispatch. If no target property is set on the event, the target will be set to this host.
Disposes this controller, removes all listeners.
Activates the next postroll ad. Does nothing if there is no postroll. Resolves with the active postroll, or null if there wasn't one.
Activates the preroll ads. Does nothing if there is no preroll. Resolves with the active preroll, or null if there wasn't one.
Skips the current ad with 'error' for the completed reason. Emits an 'adError' event. If there are more ads in the break, the next ad begins. If it's the last ad, the break ends.
No-op when no ad break is active.
Returns true if the event host has any listeners.
Returns true if the event host has any listeners for the given type.
Adds an event handler for the given typed event.
The key representing the event type to listen for.
A callback to invoke when the event with the given type is dispatched.
Optionaloptions: SignalOptions
Options for changing listening behavior.
Returns a method, when invoked, removes the handler.
Sets the source of ad breaks, or null when no source is active. A
ReadonlyTrack satisfies AdsProvider directly, so the current
playing track can be passed as-is.
Skips the currently playing ad. If there are more ads in the break, the next ad begins. If it's the last ad, the break ends. No-op when no ad break is active.
Skips the entire active ad break, advancing past all remaining ads. No-op when no ad break is active.
Provider-agnostic AdController. Holds the discovered ad breaks and derives enter/exit region events from playhead time updates.
This controller is the model for ad playback: it knows which breaks exist, which break contains the playhead, and which ad within that break is current. It does NOT create, preload, or activate any tracks — that is the responsibility of the TrackController.
A break is considered active while
startTime <= currentTime < endTime, whereendTimeisstartTime + duration. Breaks whose duration is unknown (null) or breaks which restrictjumpwill become active atcurrentTime > startTimeThis class contains no HLS- or DASH-specific logic; discovery code maps its protocol's signals to AdBreakInfo exposed by an AdsProvider.getAds, which this controller reads once the provider is set via AdController.setAdsProvider (and re-reads on
adsChange).