Page 1 of 1

How can I load local file from with x-vlc-plugin through IE

Posted: 13 Jun 2014 12:10
by kimi81817
I change the test.html for ActiveX plugin provided by vlc, and I want to test it with local video file.
but it failed, can someone please help me with this problem, thanks a lot!
<!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=UTF-8" />
<script>
var itemId = 0;
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
{
return document.getElementById(name);
}
}

function doGo(mrl)
{
var vlc = getVLC("vlc");
itemId=vlc.playlist.add(mrl);
vlc.playlist.playItem(itemId);
document.getElementById("btn_stop").disabled = false;
}

function updateVolume(deltaVol)
{
var vlc = getVLC("vlc");
vlc.audio.volume += deltaVol;
}

function doPlay()
{
vlc.playlist.playItem(itemId);

document.getElementById("btn_stop").disabled = false;
document.getElementById("btn_play").disabled = true;
}

function doStop()
{
getVLC("vlc").playlist.stop();
document.getElementById("btn_stop").disabled = true;
document.getElementById("btn_play").disabled = false;
}
</script>
</head>
<body>
<div style="margin: 50px">
<a title="file:///C:/New Folder/test.mp4" href="#" onclick="doGo(this.title);return false;">video</a> // C:\New Folder\test.mp4 is local video file to test
<span style="margin: 20px;" />
</div>
<div>
<object classid="clsid:9be31822-fdad-461b-ad51-be1d1c159921"
width="640"
height="480"
id="vlc"
events="true">
<param name="mrl" value="" />
<param name="showdisplay" value="true" />
<param name="autoloop" value="false" />
<param name="autoplay" value="false" />
<param name="volume" value="50" />
<param name="starttime" value="0" />
<embed pluginspage="http://www.videolan.org"
type="application/x-vlc-plugin"
version="videolan.vlcplugin.2"
width="640"
height="480"
name="vlc">
</embed>
</object>
</div>
<div>
<input type=button id="btn_play" value=" play " onClick='doPlay();'>
<input type=button id="btn_stop" value="stop" onClick='doStop();'>
<input type=button value="mute" onclick='getVLC("vlc").audio.togglemute();'>
<input type=button value="volume-" onclick='updateVolume(-10)'>
<input type=button value="volume+" onclick='updateVolume(+10)'>
</div>
</body>
</html>

Re: How can I load local file from with x-vlc-plugin through

Posted: 13 Jun 2014 14:05
by da2424
I have tested your site in IE9, IE11 and Firefox 30, a local video was loaded always fine for me.

But your code has some issues, I have fixed it:

Code: Select all

<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript"> var itemId = 0; 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 { return document.getElementById(name); } } function doGo(mrl) { itemId=vlc.playlist.add(mrl); vlc.playlist.playItem(itemId); document.getElementById("btn_stop").disabled = false; } function updateVolume(deltaVol) { vlc.audio.volume += deltaVol; } function doPlay() { vlc.playlist.playItem(itemId); document.getElementById("btn_stop").disabled = false; document.getElementById("btn_play").disabled = true; } function doStop() { vlc.playlist.stop(); document.getElementById("btn_stop").disabled = true; document.getElementById("btn_play").disabled = false; } </script> </head> <body onload="vlc = getVLC('objvlc');"> <div style="margin: 50px"> <a title="file:///C:/New Folder/test.mp4" href="#" onclick="doGo(this.title);return false;">video</a> // C:\New Folder\test.mp4 is local video file to test </div> <div> <object classid="clsid:9be31822-fdad-461b-ad51-be1d1c159921" width="640" height="480" id="objvlc" events="true"> <param name="mrl" value="" /> <param name="showdisplay" value="true" /> <param name="autoloop" value="false" /> <param name="autoplay" value="false" /> <param name="volume" value="50" /> <param name="starttime" value="0" /> <embed pluginspage="http://www.videolan.org" type="application/x-vlc-plugin" version="videolan.vlcplugin.2" width="640" height="480" name="objvlc" /> </object> </div> <div> <input type="button" id="btn_play" value="play" onClick='doPlay();'> <input type="button" id="btn_stop" value="stop" onClick='doStop();'> <input type="button" value="mute" onclick='vlc.audio.toggleMute();'> <input type="button" value="volume-" onclick='updateVolume(-10)'> <input type="button" value="volume+" onclick='updateVolume(+10)'> </div> </body> </html>
Now it should work better.
If your problem still occurs: Which browser version and which VLC version?

Re: How can I load local file from with x-vlc-plugin through

Posted: 15 Jun 2014 09:07
by kimi81817
thanks for your reply!
I have tried your code, but still not work.
my environment is
OS : win7 x64
tool IE 11.0.9
VLC 2.1.3

IE cannot load the ActiveX plugin, but when I install VLC, I have checked in the box of ActiveX, any thoughts about this?

Re: How can I load local file from with x-vlc-plugin through

Posted: 16 Jun 2014 18:24
by da2424
Try it on the site http://git.videolan.org/?p=npapi-vlc.gi ... ml;hb=HEAD
Normally now it will occur a security message in IE, which must be confirmed. After that it should work with local files permanently, because VLC is now correctly registered in the Addon List of IE.

I hope this helps in your case.