title: JWPlayer handle youtube errors
body: <p>I would like to handle the youtube errors in the JWPlayer, so in case the video doesn't exists or is not available for the country show a message on the player, or with javascript, i am doing something like this...</p>
  
  <pre><code>var options = {                             
                      height: 330,
                      },
                      flashplayer: '/player.swf',
                      width: 560,
                      events:{
                          onError:function(obj){
                              alert('ERROR'+obj);
                          }
                      }            ,
                          debug: 'console'
                  };
  
  
   jwplayer("player").setup(options);
   jwplayer("player").play();          
  </code></pre>
  
  <p>but its not getting inside from the onError event, even though the video doesnt even exist... and i can see in the console.. LOG (Error loading preview image: Error #2036)</p>
  
  <p>In the case of youtubes restriction country i cannot even see that in the console.</p>
  
  <p>In any case the video just show the loading animation, which it makes belieave the user that it can be load in any time, which its not true.</p>
  
  <pre><code> &lt;html xmlns="http://www.w3.org/1999/xhtml"  
    xmlns:ui="http://java.sun.com/jsf/facelets"&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>        &lt;script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/assets/jwplayer.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/assets/swfobject.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>
              </p>
  
  <pre><code>            &lt;div id="player"&gt;&lt;/div&gt;
  
              &lt;/body&gt;
          &lt;script type="text/javascript"&gt;  
              //&lt;![CDATA[  
  
              window.onload=createPlayer();
  
              function createPlayer() {
                  var flashvars = {
                      file:"http://www.youtube.com/watch?v=pnEHsUWFuNM", 
                      autostart:"true"
                  }
                  var params = {
                      allowfullscreen:"true", 
                      allowscriptaccess:"always"
                  }
                  var attributes = {
                      id:"player1",  
                      name:"player1"
                  }
                  swfobject.embedSWF("#{facesContext.externalContext.requestContextPath}/assets/player.swf", "player", "320", "196", "9.0.115", false, flashvars, params, attributes);
              }   
              function loadPlayer() {
                  var options = { 
                      height: 325,
                      flashplayer: '#{facesContext.externalContext.requestContextPath}/assets/player.swf',
                      width: 560,
                      events:{
                          onError:function(error){
                              alert('Error loading your link, please try another one');
                          }
                      }       /*     ,
                              debug: 'console'*/
                  };
                  options.file = 'http://www.youtube.com/watch?v=pnEHsUWFuNM';                    
                  options.events.onReady= function(){      
  
                      jwplayer("player").play();
  
                  };
  
                  jwplayer("player").setup(options);
              }
              //]]&gt;
          &lt;/script&gt;                
  </code></pre>
  
  <p>  </p>
  
  <p>loadPlayer to try with jwplayer.js and the createPlayer directly from SWFObject... that video exist just that it shouldnt be shown in germany, still its trying to load it.
  and if i set any other unexisting URL let say "<a href="http://www.youtube.com/watch?v=ABC" rel="nofollow">http://www.youtube.com/watch?v=ABC</a>" still keeps trying to load the unexisting video.</p>