MAF.VAST

A VAST Parser Class that will download and parse a VAST XML document. An example app for with implementation details can be found here: VASTTemplate.

new MAF.VAST()

Example

var VAST = new MAF.VAST({ wrapperLimit: 3 });

VAST.get('http://ads.example.com/vast.xml', function(error, vast) {
 // Handle the VAST response

 // Here you would get the ad from the vast object.
 // The ad's media file can then be played with the MAF mediaplayer.

 // Instantiate a VAST tracker for a given ad/creative combination.
 var tracker = new VAST.Tracker(ad, creative);
});

Classes

Tracker

Configs

timeout : {Number}

Number of miliseconds to wait for a VAST response to load from the ad server.

withCredentials : {Boolean}

A boolean to enable the withCredentials options for the VAST xml request.

wrapperLimit : {Number}

A number of available Wrapper responses that can be received with no InLine response.

Methods

get(url, callback)

Get a URL and parse the response XML into a valid VAST object.

Parameters:

NameTypeDescription
urlString

The URL for getting the VAST XML document.

callbackfunction

Function to be called once the VAST document is parsed. If an error occured the first parameter will contain this error. Null otherwise. The VAST object is passed as the 2nd parameter.

Events

onVASTError

Fired when an error has occured while parsing the VAST XML document.