video-ad-sdk
Version:
VAST/VPAID SDK that allows video ads to be played on top of any player
31 lines (30 loc) • 1.28 kB
TypeScript
import { VastAdUnit, VpaidAdUnit } from '../adUnit';
import type { VastChain, PixelTracker } from '../types';
import { type StartVideoAdOptions } from './helpers/startVideoAd';
/**
* Options map to start video ad with {@link run}
*/
export interface RunOptions extends StartVideoAdOptions {
/**
* Optional videoElement that will be used to play the ad.
*/
videoElement?: HTMLVideoElement;
/**
* Timeout number in milliseconds. If set, the video ad will time out if it doesn't start within the specified time.
*/
timeout?: number;
/**
* If provided it will be used to track the VAST events instead of the default {@link PixelTracker}.
*/
tracker?: PixelTracker;
}
/**
* Will try to start video ad in the passed {@link VastChain} and return the started VideoAdUnit.
* If there is an error starting the ad or it times out (by throw I mean that it will reject promise with the error).
*
* @param vastChain The {@link VastChain} with all the {@link VastResponse}s.
* @param placeholder Element that will contain the video ad.
* @param options - Options Map.
* @returns The video ad unit.
*/
export declare const run: (vastChain: VastChain, placeholder: HTMLElement, options: RunOptions) => Promise<VastAdUnit | VpaidAdUnit>;