Example 1.03 - Processing Show (With Duration) Playback Events with the Javascript

This example illustrates the javascript callback API for show stream related events. Events are fired by the Open Ad Streamer when a show stream is started, stopped, complete, resumed, muted, unmuted or goes fullscreen

To start receiving these events, the "fireTrackingEvents" show streams config property must be set to "true". It is "false" by default. In addition, "canFireAPICalls" must also be set to "true" (it is "true" by default).

In this example, a series of DIVs are displayed around the player. As each event fires, the corresponding DIV is turned green. If you have Firebug installed, bring up the console. Debug output is shown as each event fires so you can see the javascript callback event occur.



Show Start

Show Complete

Show Paused

Show Stopped

Show Resumed

Show Muted

Show Unmuted

Show Fullscreen

The configuration for this example is:


// An example ad event Javascript callback

function onShowStart(streamName, streamIndex) {
	debug("OVA EVENT: onShowStart('" + streamName + "', " + streamIndex + ")");
    document.getElementById('show-start').style.backgroundColor = "#00CC00";	
}

//... the other callback functions go in here



"" is defined as:


<config>
   <ova.title>
       Example 2 - Process Show Stream Events with Javascript API
   </ova.title>
   <ova.json>
       {
            "canFireAPICalls": true,

            "shows": {
                 "fireTrackingEvents": true,
                 "streams": [
                      {
                          "file":"http://streaming.openvideoads.org/shows/the-black-hole.mp4",
                          "duration":"00:00:30"
                      }
                 ]
            },

            "ads": {
                 "servers": [
                     {
                          "type": "OpenX",
                          "apiAddress": "http://openx.openvideoads.org/openx/www/delivery/fc.php"
                     }
                 ],
                 "schedule": [
                      {
                          "zone": "5",
                          "position": "post-roll"
                      }
                 ]
            },

            "debug": {
                 "debugger": "firebug",
                 "levels": "fatal, config, vast_template, vpaid, http_calls, playlist, api"
            }
       }
   </ova.json>
</config>