Amazon Vinyl
    Preparing search index...

    Interface AdController

    Tracks the ad breaks for the current media and reports when the playhead enters and exits them.

    The controller is deliberately agnostic of HLS/DASH discovery details: its input is a list of AdBreakInfo sourced from an AdsProvider (set via setAdsProvider); it derives the active break from the playhead by observing the playback controller.

    interface AdController {
        currentAd: AdInfo | null;
        currentAdBreak: AdBreakInfo | null;
        currentTrackAds: TrackAds | null;
        enterPostroll(): Promise<AdBreakInfo | null>;
        enterPreroll(): Promise<AdBreakInfo | null>;
        failAd(error: Error): void;
        hasAnyListeners(): boolean;
        hasListeners(type: keyof AdEventMap): boolean;
        on<K extends keyof AdEventMap>(
            type: K,
            handler: EventHandler<AdEventMap[K]>,
            options?: SignalOptions,
        ): Unsubscribe;
        setAdsProvider(provider: AdsProvider | null): void;
        skipAd(): void;
        skipAdBreak(): void;
    }

    Hierarchy (View Summary)

    Implemented by

    Index
    currentAd: AdInfo | null

    The ad currently playing within the active break, or null.

    currentAdBreak: AdBreakInfo | null

    The ad break currently containing the playhead, or null when the playhead is in primary content.

    currentTrackAds: TrackAds | null

    The ad breaks known for the current media.

    • 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.

      Parameters

      • error: Error

      Returns void

    • 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.

      Returns void

    • Skips the entire active ad break, advancing past all remaining ads. No-op when no ad break is active.

      Returns void