video-ad-sdk
Version:
VAST/VPAID SDK that allows video ads to be played on top of any player
31 lines (30 loc) • 1.35 kB
TypeScript
import type { VastChain, WrapperOptions, PixelTracker } from '../types';
/**
* Options map to {@link requestAd}
*/
export interface RequestAdOptions extends RequestInit {
/**
* Sets the maximum number of wrappers allowed in the {@link VastChain}.
* Defaults to `5`.
*/
wrapperLimit?: number;
/**
* Timeout number in milliseconds. If set, the request will timeout if it is not fulfilled before the specified time.
*/
timeout?: number;
/**
* Optional function to track whatever errors occur during the loading.
* Defaults to `video-ad-tracker` track method.
*/
tracker?: PixelTracker;
}
/**
* Request the ad using the passed ad tag and returns an array with the {@link VastResponse} needed to get an inline ad.
*
* @param adTag The VAST ad tag request url.
* @param options Options Map. The allowed properties are:
* @param vastChain Optional vastChain with the previous VAST responses.
* @returns Returns a Promise that will resolve with a VastChain with the newest VAST response at the beginning of the array.
* If the {@link VastChain} had an error. The first VAST response of the array will contain an error and an errorCode entry.
*/
export declare const requestAd: (adTag: string, options: RequestAdOptions & WrapperOptions, vastChain?: VastChain) => Promise<VastChain>;