title: Auto play video in JW Player
body: <p>I am trying to play a .flv video on page load using JW Player (V 4.2.88)
  I just can't make my code auto play on page load even though my code looks OK.</p>
  
  <p>I am also getting player is null or not an object in IE. If I add a button and call the Play() on it's click, the video starts playing.</p>
  
  <p>I am using JQuery, .NET 4.0 &amp; C#</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
        var player;
        function playerReady(thePlayer) {
           //this gets fired in IE, FF
           player = window.document[thePlayer.id];         
        }
        function createPlayer() {
           var flashvars = { autostart: "true", skin: "http://localhost/app/Binn/flv/modieus.swf", lightcolor: "33cc00", frontcolor: "cccccc", quality: "true" }
           var params = { allowfullscreen: "true", allowscriptaccess: "always", wmode: "opaque" }
           var attributes = { id: "player1", name: "player1" }
           swfobject.embedSWF("/app/Binn/flv/player.swf", "VPlayer", "717", "420", "10.0.1", false, flashvars, params, attributes);
        }      
  
        function Play() {
           //this line gives error in IE saying player is null or not an object
           player.sendEvent('LOAD', 'http://localhost/kvs/u/bob/soccer.flv');
        }
        $(function () {
           alert('Creating the player on page load');
           createPlayer();
        });
        $(window).load(function () {
           alert('window loaded, so auto playing video');
           Play();
        });
     &lt;/script&gt;
  
  &lt;div id="VPlayer"&gt;&lt;/div&gt;
  </code></pre>