THEOplayer Web SDK
    Preparing search index...

    Interface Ads

    The API for advertisements.


    - Integrates with 'csai', 'google-ima', 'google-dai', 'freewheel' or 'theoads'.

    interface Ads {
        currentAdBreak: null | AdBreak;
        currentAds: Ad[];
        dai?: GoogleDAI;
        playing: boolean;
        scheduledAdBreaks: AdBreak[];
        scheduledAds: Ad[];
        addEventListener<TType extends keyof AdsEventMap>(
            type: TType | readonly TType[],
            listener: EventListener<AdsEventMap[TType]>,
        ): void;
        registerServerSideIntegration(
            integrationId: CustomAdIntegrationKind,
            integrationFactory: ServerSideAdIntegrationFactory,
        ): void;
        removeEventListener<TType extends keyof AdsEventMap>(
            type: TType | readonly TType[],
            listener: EventListener<AdsEventMap[TType]>,
        ): void;
        schedule(adDescription: AdDescription): void;
        skip(): void;
        skipAdBreak(target?: number): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    currentAdBreak: null | AdBreak

    The currently playing ad break.

    currentAds: Ad[]

    List of currently playing ads.

    dai?: GoogleDAI

    The Google DAI API.


    - Only available with the feature 'google-dai'.

    playing: boolean

    Whether a linear ad is currently playing.

    scheduledAdBreaks: AdBreak[]

    List of ad breaks which still need to be played.

    scheduledAds: Ad[]

    List of ads which still need to be played.

    Methods

    • Add an ad break request.

      Parameters

      • adDescription: AdDescription

        Describes the ad break to be scheduled.

      Returns void


      - Available since v2.18.0.
      - Prefer scheduling ad breaks up front through SourceConfiguration.ads.

    • Skip the current linear ad.

      Returns void


      - This will have no effect when the current linear ad is (not yet) skippable.

    • Seek to a point in the main content timeline.

      Parameters

      • Optionaltarget: number

      Returns void


      - Available since v9.4.0.
      - Only supported for the csai integration.
      - This will have no effect when allowSkipAdBreak is not set to true in the AdsConfiguration.