Example 7 - Supporting dynamic player resizing

Loading the player ...

The configuration for this example is:


<button type="button" onClick="resizePlayer();">Change Player Size</div>
...
<script type="text/javascript">
function resizePlayer() {
	console.log("Resizing the player to " + newWidth + "x" + newHeight);

	var tmp = document.getElementById("container");
    if(tmp) { 
       var unitStr = 'px';
       tmp.style.width = parseInt(newWidth)+unitStr; 
       tmp.style.height = parseInt(newHeight)+unitStr; 

	   if(newWidth == 600) {
          newWidth = 300;
          newHeight = 220;
       }
       else {
          newWidth = 600;
          newHeight = 440;
       }
    }    
}

jwplayer("container").setup({
       flashplayer: "", 

       playlist: [
	       { file: "http://streaming.openvideoads.org:81/shows/the-black-hole.mp4", duration: 10 }
       ],

       width: 300,
       height: 220,

       plugins: {
           "../../../../dist/swf/ova-jw.swf": { 
               "ads": {
                   "servers": [
                       {
                           "type": "OpenX",
                           "apiAddress": "http://openx.openvideoads.org/openx/www/delivery/fc.php"
                       }
                   ],
                   "notice": { "textStyle": "smalltext" },
                   "schedule": [
                       {
                           "zone": "5",
                           "position": "pre-roll"
                       }
                   ]
               },

               "debug": {
                  "levels": "fatal, config, vast_template, vpaid, http_calls, playlist, api"
               }
           }
       }
});
</script>