Embedding VLC plugin on HTML page

前端 未结 4 1777
轻奢々
轻奢々 2021-02-04 20:55

I have a html file (getStream.html) that takes a stream from a certain url and show it. The code is the following:



        
4条回答
  •  抹茶落季
    2021-02-04 21:36

    test.html is will be helpful for how to use VLC WebAPI.

    test.html is located in the directory where VLC was installed.

    e.g. C:\Program Files (x86)\VideoLAN\VLC\sdk\activex\test.html

    The following code is a quote from the test.html.

    HTML:

    
      
      
      
      
      
      
      
      
      
    
    

    JavaScript:

    You can get vlc object from getVLC().
    It works on IE 10 and Chrome.

    function getVLC(name)
    {
        if (window.document[name])
        {
            return window.document[name];
        }
        if (navigator.appName.indexOf("Microsoft Internet")==-1)
        {
            if (document.embeds && document.embeds[name])
                return document.embeds[name];
        }
        else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
        {
            return document.getElementById(name);
        }
    }
    
    var vlc = getVLC("vlc");
    
    // do something.
    // e.g. vlc.playlist.play();
    

提交回复
热议问题