Example 2.05.02 - A pre-roll ad only using SWFObject and direct Javascript to SWF calls

This will be replaced by the SWF.

The configuration for this example is:


<script type="text/javascript">
	function changeVolume(volume) {
	   try {
	      var result = document.getElementById("player1").ovaSetActiveLinearAdVolume(volume);
	      alert("result returned from ovaSetActiveLinearAdVolume() is: " + result);
	   }
	   catch(error) {
	   	  alert(error);
	   }
	}

   function buildOVAConfiguration() {
      var result = '';
      var OAS_url = 'http://oasc16.247realmedia.com/RealMedia/ads/adstream_sx.ads';
      var OAS_sitepage = 'openvideoads.org/vast';
      var OAS_listpos = 'x01';
      OAS_rdl = OAS_rdl != '' ? OAS_rdl.split("&")[1] : '';

      result += '{"blockUntilOriginalPlaylistLoaded":true,';
      result += '"debug":{';
      result += '"debugger":"firebug",';
      result += '"levels":"fatal, config, vast_template"';
      result += '},';
      result += '"ads":{';
      result += '"pauseOnClickThrough":true,';
      result += '"servers":[';
      result += '{';
      result += '"type":"OAS",';
      result += '"apiAddress":"' + OAS_url + '",';
      result += '"customProperties":{';
      result += '"target":["overlay","XE","' + OAS_rdl + '", "if_nt_CookieAccept=\'' + OAS_CA + '\'","XE"]';
      result += '}';
      result += '}';
      result += '],';
      result += '"schedule":[';
      result += '{';
      result += '"zone":"' + OAS_sitepage + '@' + OAS_listpos + '",';
      result += '"position":"pre-roll"';
      result += '}';
      result += ']';
      result += '}}';
      return escape(result);
   }

   var flashvars = {
      'plugins':    	OVA_PLUGIN_2,
      'playlist':   	'none',
      'repeat': 		'list',
      'autostart':		'false',
      'dock':			'true',
      'frontcolor':		'ffffff',
      'title':			'Big%20Buck%20Bunny%20Trailer',
      'image':			'http://content.bitsontherun.com/thumbs/nPripu9l-480.jpg',
      'stretching':		'uniform',
      'ping.script':	'http://content.bitsontherun.com/pings/',
      'lightcolor':		'009999',
      'controlbar':		'over',
      'displayclick':	'play',
      'backcolor':		'000000',
      'playlistsize':	'200',
      'skin':           'http://content.bitsontherun.com/skins/VFgGj89b.swf',
      'file':			'http://content.bitsontherun.com/jwp/nPripu9l.xml',
      'ova.json':       buildOVAConfiguration()
   };

   var params = {
      'allowfullscreen':    'true',
      'allowscriptaccess':  'always',
      'bgcolor':            '#000000'
   };

   var attributes = {
      'id':                 'player1',
      'name':               'player1'
   };

   swfobject.embedSWF(OVA_PLAYER_2, 'player', '480', '272', '9', 'false', flashvars, params, attributes);
</script>

<ul>
  <li><a href="#" onclick="changeVolume(0);">
    Mute ad
  </a></li>
  <li><a href="#" onclick="changeVolume(50);">
     Middle volume
  </a></li>
  <li><a href="#" onclick="changeVolume(100);">
    Maximum volume
  </a></li>
</ul>