THEOplayer Web SDK
    Preparing search index...

    Interface ClientSideAdIntegrationHandlerExperimental

    A handler for a custom client-side ad integration.

    In a client-side ad integration, ads are separate from the content: the integration loads its ads from an AdDescription, and pauses the content to play a linear ad.

    Use Ads.registerClientSideIntegration to register an integration with the player.

    interface ClientSideAdIntegrationHandler {
        destroy?(): MaybeAsync<void>;
        play?(): MaybeAsync<void>;
        resetSource?(): MaybeAsync<void>;
        schedule(adDescription: AdDescription): MaybeAsync<void>;
        setSource?(source: SourceDescription): MaybeAsync<SourceDescription>;
        skipAd?(ad: Ad): void;
    }

    Hierarchy (View Summary)

    Index
    • Experimental

      Handler which will be called when the player starts playing the current source for the first time, before any content is shown.

      This allows the integration to play pre-roll ads, or to initialize ad SDKs that require a user gesture. To play a pre-roll, call ClientSideAdIntegrationController.startLinearAdBreak before the returned promise resolves. The player waits for the returned promise, and then starts playing the content unless linear ad playback was started. If the promise does not settle within a timeout and no linear ad break was started, the player fires a non-blocking aderror event and starts playing the content.

      Returns MaybeAsync<void>

      • This is only called if this integration has ads scheduled before the first play.
      • If this handler is missing, the player starts playing the content immediately.
      • If this handler throws or rejects with an error, the player fires a non-fatal aderror event (as if by calling CustomAdIntegrationController.error) and starts playing the content.