简体   繁体   中英

Unable to play video with VLC activeX plugin in IE9 and earlier

I am trying to play a video in IE9 and earlier versions. For that I used activeX plugin to load VLC Media Player (that is my basic requirement).

When I tried to execute my code I got an error thrown:

Unable to get value of the property 'playlist': object is null or undefined 

My code as follows:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml">
       <head>
           <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
           <title>VLC API</title>
           <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
           <script>
                 $(document).ready(function(){  
                      play();
                       displayPlugins();
                     $(function(){ 
            $("#vlc").css({ "width": "400px", "height": "300px" });
                  });
                           });
                  function play()
                 {
                    var vlc=document.getElementById("vlc");
                           alert("play video");
                    var url="rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";
             var options=new Array(":aspect-ratio=4:3","-rtsp-tcp");
             var id= vlc.playlist.add(url,"",options);
             vlc.playlist.playItem(id);
         }


         function displayPlugins()
           {
              alert("plugins");
        var player="<object type='application/x-vlc-plugin' id='vlc' width='300' height='225' classid='clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921' codebase='http://activex.microsoft.com/controls/vb5/comdlg32.cab'></object>";
         $("#video_holder").html(player);
     }
      </script>

  </head>

<body>
      <div id="video_holder" style="border:1px solid #00FF33; height:350px;"></div>
</body>

Can anybody help me where I'm getting wrong?

You are doing:

var vlc=document.getElementById("vlc");

But on HTML, you have

<div id="video_holder" style="border:1px solid #00FF33; height:350px;"></div>

So in theory you want:

var vlc=document.getElementById("video_holder");

You might have more problems after that, but start here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM