THEOplayer Web SDK
    Preparing search index...

    Interface CustomAdIntegrationController

    The common controller for a custom ad integration.

    Use it from your CustomAdIntegrationHandler to update the state of your integration: create ads and ad breaks, report their playback progress, and report errors.

    interface CustomAdIntegrationController {
        adBreaks: readonly AdBreak[];
        ads: readonly Ad[];
        content: ReadonlyContentPlayer;
        integration: CustomAdIntegrationKind;
        beginAd(ad: Ad): void;
        createAd(init: AdInit, adBreak?: AdBreak): Ad;
        createAdBreak(init: AdBreakInit): AdBreak;
        endAd(ad: Ad): void;
        endAdBreak(adBreak: AdBreak): void;
        error(error: Error): void;
        fatalError(error: Error, code?: ErrorCode): void;
        removeAd(ad: Ad): void;
        removeAdBreak(adBreak: AdBreak): void;
        removeAllAds(): void;
        skipAd(ad: Ad): void;
        updateAd(ad: Ad, init: Partial<AdInit>): void;
        updateAdBreak(adBreak: AdBreak, init: Partial<AdBreakInit>): void;
        updateAdProgress(ad: Ad, progress: number): void;
    }

    Hierarchy (View Summary)

    Index
    adBreaks: readonly AdBreak[]

    The scheduled ad breaks managed by this integration.

    Use createAdBreak and removeAdBreak to add or remove ad breaks.

    ads: readonly Ad[]

    The scheduled ads managed by this integration.

    Use createAd and removeAd to add or remove ads.

    The playback state of the content.

    Use this instead of ChromelessPlayer.currentTime and friends to decide when to load or play ads, so your integration never observes the playback state of a linear ad from another integration.

    The identifier for this integration, as it was passed to Ads.registerServerSideIntegration or Ads.registerClientSideIntegration.

    • Create a new ad break.

      This can be used to indicate where ad breaks can be expected in advance, before populating those ad breaks with ads.

      Parameters

      • init: AdBreakInit

        The initial properties to be set on the created ad break.

      Returns AdBreak

      Error If there is already an existing ad break with the given AdBreakInit.timeOffset.

    • End the given ad.

      Parameters

      Returns void

    • Fire an aderror event on the player.

      This does not stop playback.

      Parameters

      • error: Error

        The error.

      Returns void

    • Remove the given ad.

      Parameters

      Returns void

    • Remove the given ad break and all of its ads.

      Parameters

      • adBreak: AdBreak

        The ad break to be removed.

      Returns void

    • Remove all ads and ad breaks.

      Returns void

    • Skip the given ad.

      Parameters

      Returns void

    • Update the given ad.

      Parameters

      • ad: Ad

        The ad to be updated.

      • init: Partial<AdInit>

        The properties to be updated on the ad.

      Returns void

    • Update the playback progression of the given ad.

      Parameters

      • ad: Ad

        The ad to be updated.

      • progress: number

        The playback progress, as a number between 0 (at the start of the ad) and 1 (at the end of the ad).

      Returns void

      Error If the ad is not started.