Hi,
(sorry for my English)
Where I can get simple example how to integrate OVA for AS3?
I don't understand how to join VASTController and flash player. I add VASTController, load config and template and how after that I can display video from playlist?
Hi Irena,
There currently isn't a simple example, but you are right - there really should be! I'm working on one right now - sorry about that.
In the meantime, the best sources of code that illustrate how OVA can be integrated into a player are the OVA for JW5 and OVA for Flowplayer plugins.
The source for each can be found here:
JW5:
http://developer.longtailvideo.com/ova/browser/trunk/ova.jwplayer.5x/src/org/openvideoads/plugin/jwp...
Flowplayer:
http://developer.longtailvideo.com/ova/browser/trunk/ova.flowplayer/src/org/openvideoads/plugin/flow...
So to your specific question, you need to explicitly load up the ad video and configure it in your playlist once the template has been obtained.
If you've registered the listener for onTemplateLoaded():
_vastController.addEventListener(TemplateEvent.LOADED, onTemplateLoaded);Then in your onTemplateLoaded() function you can do something like this (this code is taken from OVA for JW5):
protected function onTemplateLoaded(event:TemplateEvent):void {if(event.template != null) {
if(event.template.hasAds()) {
doLogAndTrace("PLUGIN NOTIFICATION: VAST template loaded - " + event.template.ads.length + " ads retrieved", event.template, Debuggable.DEBUG_VAST_TEMPLATE);
}
else doLog("PLUGIN NOTIFICATION: No ads to be scheduled - only show streams will be played", Debuggable.DEBUG_VAST_TEMPLATE);
}
else doLog("PLUGIN NOTIFICATION: No ads to be scheduled - only show streams will be played", Debuggable.DEBUG_PLAYLIST);
loadRuntimePlaylistAfterTemplateLoadEvent();
}
You'll see in that code that I check to see if the template has any ads in it, and if it does, then I call a function to load up the playlist (loadRuntimePlaylistAfterTemplateLoadEvent())
Saying that, for an example, I think the OVA for Flowplayer code is the best to reference.
In the OVA for Flowplayer example, a listener is registered so that the Flowplayer plugin gets notified every time OVA schedules a stream as it makes it's ad calls:
_vastController.addEventListener(StreamSchedulingEvent.SCHEDULE, onStreamSchedule);If you register that listener, then as OVA makes the ad calls and creates it's own internal playlist of ads and show streams, that callback (onStreamSchedule) will be called.
Take a look at the onStreamSchedule() method in the OVA for Flowplayer plugin class (OpenAdStreamer.as) - the method starts at line 745:
http://developer.longtailvideo.com/ova/browser/trunk/ova.flowplayer/src/org/openvideoads/plugin/flow...
If you walk through that code, you'll get a good handle on how to pull out the attributes of the video ad so that you can then load up the media into your player.
But ask questions as you go and I'll try to provide some guidance...
Paul