title: loadByvideoId is not a function
body: <p>The below fiddle when opened in chrome,fox and iE its working fine</p>
  
  <pre><code>'http://jsfiddle.net/wmdPN/'
  </code></pre>
  
  <p>When i copy the code from the fiddle and use it in my machine,its not working
  i m getting error as o.loadVideoById is not a function. why is that so ?
  what am i doing wrong?</p>
  
  <p>The code i used is as follows( the same as fiddle)</p>
  
  <pre><code> &lt;html&gt;
  &lt;body&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"&gt;               &lt;/script&gt;
  
  &lt;a name="ytplayer"&gt;&lt;/a&gt;
  &lt;div id="ytplayer_div1"&gt;You need Flash player 8+ and JavaScript
      enabled to view this video.&lt;/div&gt;
  &lt;div id="ytplayer_div2"&gt;&lt;/div&gt;
  &lt;script type="text/javascript"
      src="http://ajax.googleapis.com/ajax/libs/swfobject/2/swfobject.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  
      var ytplayer_playlist = [];
      var ytplayer_playitem = 0;
  
      function ytplayer_render_player() {
          if (/\d+/.test(window.location.hash)) {
              ytplayer_playitem = parseInt(/\d+/.exec(window.location.hash)) - 1;
          }
          swfobject.embedSWF('http://www.youtube.com/v/'
                  + ytplayer_playlist[ytplayer_playitem]
                  + '&amp;enablejsapi=1&amp;rel=0&amp;fs=1'
                  + (/\d+/.test(window.location.hash) ? '&amp;autoplay=1' : ''),
                  'ytplayer_div1', '425', '344', '8', null, null, {
                      allowScriptAccess : 'always',
                      allowFullScreen : 'true'
                  }, {
                      id : 'ytplayer_object'
                  });
      }
  
      function ytplayer_render_playlist() {
          for ( var i = 0; i &lt; ytplayer_playlist.length; i++) {
              var img = document.createElement("img");
              img.src = "http://img.youtube.com/vi/" + ytplayer_playlist[i]
                      + "/default.jpg";
              var a = document.createElement("a");
              a.href = "#ytplayer";
              //
              // Thanks to some nice people who answered this question:
              // http://stackoverflow.com/questions/1552941/variables-in-anonymous-functions-can-someone-explain-the-following
              //
              a.onclick = (
  
              function(j) {
                  return function() {
                      ytplayer_playitem = j;
                      ytplayer_playlazy(1000);
                  };
              })(i);
              a.appendChild(img);
              document.getElementById("ytplayer_div2").appendChild(a);
          }
      }
  
      function ytplayer_playlazy(delay) {
          //
          // Thanks to the anonymous person posted this tip:
          // http://www.tipstrs.com/tip/1084/Static-variables-in-Javascript
          //
          if (typeof ytplayer_playlazy.timeoutid != 'undefined') {
              window.clearTimeout(ytplayer_playlazy.timeoutid);
          }
          ytplayer_playlazy.timeoutid = window.setTimeout(ytplayer_play,
                  delay);
      }
  
      function ytplayer_play() {
          var o = document.getElementById('ytplayer_object');
          if (o) {
              o.loadVideoById(ytplayer_playlist[ytplayer_playitem]);
          }
      }
  
  
       function onYouTubePlayerReady(playerid) {
          var o = document.getElementById('ytplayer_object');
          if (o) {
      o.addEventListener("onStateChange",        "ytplayer_statechange");
              o.addEventListener("onError", "ytplayer_error");
          }
      }
      //
      //State Change Handler
      //* Sets up the video index variable
      //* Calls the lazy play function
      //
  
      function ytplayer_statechange(state) {
          if (state == 0) {
              ytplayer_playitem += 1;
              ytplayer_playitem %= ytplayer_playlist.length;
              ytplayer_playlazy(5000);
          }
      }
      //
      //Error Handler
      //* Sets up the video index variable
      //* Calls the lazy play function
      //
  
      function ytplayer_error(error) {
          if (error) {
              ytplayer_playitem += 1;
              ytplayer_playitem %= ytplayer_playlist.length;
              ytplayer_playlazy(5000);
          }
      }
      //
      //Add items to the playlist one-by-one
      //
      ytplayer_playlist.push('tGvHNNOLnCk');
      ytplayer_playlist.push('_-8IufkbuD0');
      ytplayer_playlist.push('wvsboPUjrGc');
      ytplayer_playlist.push('8To-6VIJZRE');
      ytplayer_playlist.push('8pdkEJ0nFBg');
      //
      //These lines have been moved to the bottom
      //
      ytplayer_render_player();
      ytplayer_render_playlist();
  &lt;/script&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>