title: Issues in loading dynamic player through script
body: <p>I am trying to load a dynamic player according to the browser like activeX plugin for Internet explorer using object tag and vlc plugin for Firefox and Google Chrome using embed tag, so I have tried to include it in the script so that onload it can detect what browser it is and display the player according but unfortunately I'm getting the following error:</p>
  
  <p>Unable to get value of the property 'add': object is null or undefined</p>
  
  <p>Following is my code:</p>
  
  <pre><code>   &lt;head&gt;
  
     &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt; &lt;/script&gt;
     &lt;script type="text/javascript"&gt;
          var client = "FF";
  
                          $(document).ready(function(){
                              checkIE();
                              startUp();
                              //startIt();
  
                              $(function(){ 
              $("#vlcIE").css({ "width": "400px", "height": "300px" });
                    });
                          });
  
                          function checkIE() {
                              var clientCheck = window.navigator.appName;
                              if (clientCheck == "Microsoft Internet Explorer") {
                                  alert("IE");
                                  client = "IE";
                                  return true;
                              } else {
                                  alert("FF");
                                  client = "FF";
                                  return false;
                              }
                          }
  
                          function startIt(){
                              if(client == "IE"){
                                      playInIE();
                              }else{
                                      playInOthers();
                              }
  
                          }
  
                          function playInOthers() {
                              alert("playin FF");
                              var players = document.getElementsByName("video1");
                              var options = new Array("");
                              url = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";
  
                              var id = players[0].playlist.add(url, null, options);
                              players[0].playlist.playItem(id);
                              alert("playing video");
                          }
  
                          function playInIE() {
                              alert("play in IE");
                              var vlc = document.getElementById("vlcIE");
                              var options = new Array(":aspect-ratio=16:10", "--rtsp-tcp");
                              //var options=[":ts-csa-ck="+EncryptionkeyValue];
                              var urlVideofile = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";
                              var targetURL = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";
                              var itemId = vlc.playlist.add(targetURL, "", options);
                              var id = vlc.playlist.add(urlVideofile, null, options);
                              vlc.playlist.playItem(id);
                          }
  
                          function startUp(){
                              var player;
                              if (client == "IE") {
                                      player = "&lt;object type='application/x-vlc-plugin' id='vlcIE' width='300' height='225'  classid='clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921' &gt;&lt;/object&gt;";
  
                              } else {
                                      player = "&lt;embed type='application/x-vlc-plugin' pluginspage='http://www.videolan.org'  id='vlc' name='video1'  autostart='yes'   toolbar='false'  loop='yes' width='400' height='300'                                   target='rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov' /&gt;";
                              }
  
                              //$("#video_holder").html(player);
                              document.getElementById("video_holder").innerHTML=player;
                         }
  
  
    &lt;/script&gt;
  
      &lt;/head&gt;
  
         &lt;body&gt;
  
         &lt;div id="video_holder" style="border:1px solid #00FF33"&gt;&lt;/div&gt;
            &lt;button type="button" id="start" onClick="startIt()"&gt;Start&lt;/button&gt;
  
          &lt;/body&gt;
  </code></pre>