Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

How VASTController decides when to play ad?

4 replies [Last post]
Reply

Hello,

First of all, thanks you guys for working on this project.

I'm currently trying to implement the OVA framework with a custom player.
I did some code (using OpenAdStreamer classes as example) but I'm stuck in finding how the VASTController object manages the exact time when an ad must to play.
I suppose that it is related to :

_vastController.processTimeEvent(_activeStreamIndex, new TimeEvent(current * 1000, total));

But what happens after? Should I listen for an event dispatched by _vastController?

Is somehow related to the Player's Playlist? (Right now I'm returning an empty playlist - just for testing)

Many thanks,
Codrin

Reply

Hi...

So you are right.. here's what happens:

1. When the VASTController does a load(), it makes the ad calls and gets back a set of ads that it then sequences as a sort of "ad injected" playlist that it controls. That playlist is known within the VASTController as a Stream Sequence which is basically an array of clips to play (ad streams and show clips).

So if you have two show clips with a pre-roll in front of each clip, the VASTController creates a stream sequence that would look like:

index 0: pre-roll clip
index 1: show clip
index 2: pre-roll clip
index 3: show clip

2. Now, as the player goes along it has to report the following to the VASTController so that it knows whether or not it is actually suppose to be processing something in relation to an ad:

a. The index of the currently active clip within the player (in relation to the index number within the Stream Sequence)

b. The time (in milliseconds) that the current clip is playing

These two elements are reported to the VASTController via the following interface:

_vastController.processTimeEvent(streamIndex:int, timeEvent:TimeEvent)

3. But, reporting these two elements to the VASTController does not result in the controller magically playing the ad - it is the responsibility of the player itself to load up and play the ad and show clips.

There are two different models that can be deployed by the player to control the loading of the ads and the show clips:

a. Load up the clips into the native player playlist as the VASTController schedules each clips while it is creating the Stream Sequence (this is the model used by OVA for Flowplayer)

b. Load up the clips on demand from an internally held playlist within your custom implementation - then as the player progresses by pulling the appropriate clip out of that internal playlist at runtime (this is the model used by OVA for JW)

To get a handle on each model you can consult the OVA for JW and OVA for Flowplayer source, but here's some info to help:

<b>LOADING CLIPS WHEN THEY ARE SCHEDULED</b>

To receive a callback from the VASTController when it schedules a clip at 'load' time, you need to register some listeners. Specifically to load up scheduled streams you need to register a listener for the `StreamSchedulingEvent.SCHEDULE` event as follows:

_vastController.addEventListener(StreamSchedulingEvent.SCHEDULE, onStreamSchedule);

Each time the VASTController schedules a clip it calls `onStreamSchedule` passing in a `event:StreamSchedulingEvent`.

You can then grab out the actual clip from that event via `event.stream` and either a `org.openvideoads.vast.schedule.Stream` or `org.openvideoads.vast.schedule.ads.AdSlot` will be returned depending on whether or not it's just a standard show stream of an ad stream.

If you look at the OVA for Flowplayer implementation of `onStreamSchedule` you will see a test like this early on in the method:

if(event.stream is AdSlot) {
   // process this clip as though it's an ad stream
}
else {
   // process it as though it's a show stream
}

In the model where you are processing the ad scheduled playlist as the VASTController creates it, you then have to elect to do something with the OVA Stream Sequence item (Stream or AdSlot) as you get it. In the OVA for Flowplayer case, the item is converted to a Flowplayer Clip object and loaded directly into the player playlist.

As a result when the VASTController has finished it's scheduling process, the player has a fully ad scheduled playlist loaded up and ready to go.

<b>LOADING CLIPS WHEN THEY ARE REQUIRED AT RUNTIME<b>

Alternatively, if you look at the OVA for JW5 plugin source, you will notice that it has a method called `loadJWClip()` - this method gets called when the player realises that it's time to load up a new clip (by reaching the end of the current clip, by the user pressing the play button etc.)

`loadJWClip()` relies on a `Playlist` being available - the OVA for JW plugin creates a playlist from the VASTController Stream Sequence. In the case of the OVA for JW plugin it does this with the following code:

new JWPlaylist(_vastController.streamSequence,
                       _vastController.config.showsConfig.providersConfig,
                       _vastController.config.adsConfig.providersConfig);

`JWPlaylist` class is a class that has been defined along with the OVA for JW plugin that is based on the OVA for AS3 `org.openvideoads.vast.playlist.DefaultPlaylist` class.

Then as the player goes along, it just makes a call to the JWPlaylist that the plugin holds and gets the next clip in the playlist out of it via:

var item:JWPlaylistItem = _playlist.nextTrackAsPlaylistItem() as JWPlaylistItem;

Hope this helps,

Paul

Reply

Thanks for you wonderful support, I have more than need.
I'll be back with results after using the OVA Flowplayer approach.

Reply

Thanks again for your help, is working.

Reply

Is me again, I'm trying to get the data regarding the clickSign tag from json file - so I can build the click sign region by my own.

It appears that _vastController.config doesn't contains anything about this.
Could you, please, point me here should I search?

Thanks,
Codrin

Post new comment

  • Allowed HTML tags: <code> <blockquote> <em> <strong> <strike> <ul> <li> <ol>
  • You may post code using <code>...</code> .
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options