Interface GoogleDAI

The Google DAI API.


- Available since v3.7.0.

interface GoogleDAI {
    snapback: boolean;
    sourceTransformer: ((url: string) => string | Promise<string>);
    contentTimeForStreamTime(time: number): number;
    replaceAdTagParameters(adTagParameters?: Record<string, string>): void;
    streamTimeForContentTime(time: number): number;
}

Properties

snapback: boolean

Whether snapback is enabled. When enabled and the user seeks over multiple ad breaks, the last ad break that was seeked past will be played.

sourceTransformer: ((url: string) => string | Promise<string>)

A source transformer which will receive the source as returned from Google DAI before loading it in the player. This capability can be useful if you need to add authentication tokens or signatures to the source URL as returned by Google.

Methods

  • Returns the content time without ads for a given stream time. Returns the given stream time for live streams.

    Parameters

    • time: number

      The stream time with inserted ads (in seconds).

    Returns number

  • Replaces all the ad tag parameters used for upcoming ad requests for a live stream.

    Parameters

    • OptionaladTagParameters: Record<string, string>

      The new ad tag parameters.

    Returns void

  • Returns the stream time with ads for a given content time. Returns the given content time for live streams.

    Parameters

    • time: number

      The content time without any ads (in seconds).

    Returns number