I have a requirement to call an API to my server from the device before playing the media file in VAST Tag.
I am able to load the javascript with
<MediaFiles>
<MediaFile delivery="progressive" width="16" height="9" type="application/javascript" apiFramework="VPAID">
<![CDATA[<URL TO JS]]>
</MediaFile>
</MediaFiles>
But how do I call a function inside the loaded javascript and then load the 3rd party VAST TAG with some information.
EDITED
I need to load 3rd party VAST tag inside a 3rd party video player. We have the URL to the 3rd party VAST like : http://demo.tremorvideo.com/proddev/vast/vast_wrapper_linear_1.xml
I do not have the control where the URL will be loaded on which VAST player. I am testing here : http://zutils.zedo.com/vastvalidator/#/vastInspector
But before loading the VAST URL, I need to make REST API call to our backend, get the response and make some decisions on the client, then call the 3rd party VAST.
So after our rest API call, the 3rd party VAST might look like : http://demo.tremorvideo.com/proddev/vast/vast_wrapper_linear_1.xml?rest_response=
How do I create a wrapper VAST Tag to make this happen?
First things first:
Your question is (currently) confusing, as it's not clear what you want to achieve. What I got so far is:
Assuming the VPAID is yours (Proxy VPAID)
Every player which supports VPAID (and your VPAID version) will call the
initAd()
function. There is no need to implement a magic function to contact your API for the third party VAST tag. Just implement the API call with VAST response, so it will be executed ifVPAID.initAd
gets called.Note 1: Your VPAID would need to be a fully qualified VAST/VPAID player itself.
Note 2: You would need to implement it for JavaScript and Flash
Assuming the VPAID isn't yours
No VPAID will provide a functionality to replace the content - the advertiser actually wants to serve - with different content. Not via VAST or anything. Cause it would not make sense for the advertiser ;)
Assuming the player is yours
You could implement that API call (simple VAST resource request) into your player, so it will get the third party VAST directly. No VPAID needed.
Note: Please also have a look for VAST Wrapper - this might help.
If nothing of this is what you want to achieve, please please please edit your question so it is 100% clear what you are asking for.
I hope this was helpful somehow and have a nice day!