video-ad-sdk
Version:
VAST/VPAID SDK that allows video ads to be played on top of any player
16 lines (15 loc) • 729 B
JavaScript
import { getCreativeData } from '../../../vastSelectors';
import { viewmode } from './viewmode';
export const initAd = (creativeAd, videoAdContainer, vastChain) => {
const { width, height } = videoAdContainer.element.getBoundingClientRect();
const mode = viewmode(width, height);
const desiredBitrate = -1;
const creativeData = getCreativeData(vastChain[0].XML);
videoAdContainer.addSlot(width, height);
const environmentVariables = {
slot: videoAdContainer.slotElement,
videoSlot: videoAdContainer.videoElement,
videoSlotCanAutoPlay: videoAdContainer.isOriginalVideoElement
};
creativeAd.initAd(width, height, mode, desiredBitrate, creativeData, environmentVariables);
};