Making Ad Requests

This tutorial shows how to make an ad request of the backend and get an ad response using the HTML5 SDK.

var adCallModule = new videoplaza.core.AdCallModule("http://vp-validation.videoplaza.tv"),
    contentMetadata = {
      category : 'validation',
      tags     : ['standard'],
    },
    requestSettings = {
      height : myPlayer.height,
      width : myPlayer.width,
      insertionPointType : 'onBeforeContent', //prerolls
      maxBitRate : 800
    };

//make new ad request
adCallModule.requestAds(contentMetadata, requestSettings, onSuccess, onFail);

// get ads array 0~N
function onSuccess(ads){
  console.log(ads);
}

function onFail(erroMsg) {
  console.log(erroMsg);
}

Was this article helpful?