Skip to content

Instantly share code, notes, and snippets.

@afuggini
Last active April 30, 2018 02:10
Show Gist options
  • Save afuggini/6c5da80a1ffd50b3f1ed392785758df0 to your computer and use it in GitHub Desktop.
Save afuggini/6c5da80a1ffd50b3f1ed392785758df0 to your computer and use it in GitHub Desktop.
VPAID container class template
class VPAIDContainer {
constructor () {
// The slot is the div element on the main page that the ad is supposed to occupy
this._slot = null
// The video slot is the video object that the creative can use to render and video element it might have.
this._videoSlot = null
}
initAd (width, height, viewMode, desiredBitrate, creativeData, environmentVars) {
// slot and videoSlot are passed as part of the environmentVars
this._slot = environmentVars.slot
this._videoSlot = environmentVars.videoSlot
console.log('initAd')
}
startAd () {
console.log('startAd')
}
stopAd () {
}
setAdVolume (value) {
}
getAdVolume () {
}
resizeAd (width, height, viewMode) {
}
pauseAd () {
}
resumeAd () {
}
expandAd () {
}
getAdExpanded (value) {
}
getAdSkippableState (value) {
}
collapseAd () {
}
skipAd () {
}
subscribe (callback, eventName, context) {
}
unsubscribe (eventName) {
}
getAdIcons () {
}
getAdDuration () {
}
getAdHeight () {
}
getAdWidth () {
}
getAdLinear () {
}
getAdRemainingTime () {
}
handshakeVersion () {
return '2.0'
}
}
global.getVPAIDAd = function () {
return new VPAIDContainer()
}
export default VPAIDContainer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment