| Version 9 (modified by paul, 2 years ago) (diff) |
|---|
TracNav
Project
Dev Corner (restricted)
- Register for Access
- Download Latest Releases
- Browse Source Code
- Accessing Subversion
- Release Archive
- Report an Issue
Support
Other Resources
Integrating OVA into an MRSS based Custom Player with an In-Player Playlist Controller
This tutorial explores how to integrate OVA to work with an MRSS based custom player that has an in-build playlist controller.
1. The Custom Player
The custom player works as follows:
- The player loads an MRSS playlist (declared to the player as a flashvar)
- An in-built playlist controller displays each show clip in the MRSS playlist
- Users select the required clip to play
- Upon selection, the player loads up and plays the clip
2. The OVA Integration Requirements
When OVA is integrated, the player is to work as follows:
- The player loads an MRSS playlist - the MRSS playlist contains a custom field against each playlist item declaring the ad server call to make for the clip in question
- The in-built playlist controller is to display the MRSS playlist items - no ad clips are to be displayed in the playlist
- When a user selects a clip to play, the associated ad call is to be made resulting in the playback of a pre-roll clip before the selected show clip
3. The OVA Operating Model
Because an MRSS playlist may contain many clips, it does not make sense for OVA to instantiated once resulting in a flood of ad calls to obtain pre-rolls for each ad in the playlist.
The preferred model is to use OVA to load and manage the ad "on demand" as each clip is selected for playback.
4. Implementing OVA to work "on demand" managing clip playback clip by clip
4.1 Instantiating OVA
OVA is controlled via a class called VASTController.
The following code illustrates how to instantiate the framework:
4.2 Configuring the OVA Framework
Typically to configure the OVA framework, the following code is used:
_vastController = new VASTController(); _vastController.startStreamSafetyMargin = 500; _vastController.endStreamSafetyMargin = 500; _vastController.initialise(rawConfig);
This code tells OVA to set a 500 millisecond delay on triggering tracking events at the start and end of ad clips, and to initialise itself with the supplied raw Object that contains the OVA configuration properties.
Eventually that OVA configuration object will be converted into an org.openvideoads.vast.config.Config object. The VASTController does this as part of the initialise() method.
Setting up the raw object is relatively straight forward.
There are two ways to setup the raw OVA configuration object:
- Directly as an AS3 object
- Indirectly via JSON configuration
4.1 Setting up the Raw OVA Configuration Object via JSON configuration data
The following OVA JSON configuration represents a simple pre-roll setup with a direct ad server call. Some debug levels are also set.
{
"debug": { "levels": "fatal, config, vast_template" },
"ads": {
"schedule": [
{
"position": "pre-roll",
"tag": "your-ad-server-ad-tag-goes-in-here"
]
}
}
To create a org.openvideoads.vast.config.Config object given this JSON setup, use the following code snippet (this code snippet uses the Adobe as3corelib JSON parser):
import org.openvideoads.vast.config.Config;
...
var ovaJSONData:String = "{ 'debug': { 'levels': 'fatal, config, vast_template' }, 'ads': { 'schedule': [ { 'position': 'pre-roll', 'tag': 'your-ad-server-ad-tag-goes-in-here' ] } }";
try {
var ovaConfig:Config = JSON.decode(ovaJSONData, false);
}
catch(e:Error) {
// parsing exception when config read in
}
4.2 Setting up the Raw OVA Configuration Object directly as a AS3 Object
Alternatively you can setup the raw OVA config object directly via code such as:
var rawConfig:Object ;
rawConfig = {
debug: { levels: "fatal, config, vast_template" },
ads: {
schedule: [
{
position: "pre-roll",
tag: "your-ad-server-ad-tag-goes-in-here"
]
}
}
