Embed and control vlc in Firefox with Javascript
Posted: 05 Feb 2009 14:29
Hi,
I'm using vlc 0.9.8a and Firefox 3.0.5
in this webpage http://www.davide83.altervista.org/vlc.html I'm trying to embed vlc and control it with javascript, but on my machine there no way to make it run properly.
I followed this http://wiki.videolan.org/Windows.
The autoplay parameter is "yes", and the video actually starts well, but none of the javascript controls I wrote seem to work.
The Firefox's Error Console reports messages like:
Error: document.getElementsByName("video1").play is not a function
Error: document.getElementById("vlc").play is not a function
Error: vlc.stop is not a function
..is not a function? And then what the heck is it?
Why ???
( )
You can easily find the html source, but anyway it's:
I'm using vlc 0.9.8a and Firefox 3.0.5
in this webpage http://www.davide83.altervista.org/vlc.html I'm trying to embed vlc and control it with javascript, but on my machine there no way to make it run properly.
I followed this http://wiki.videolan.org/Windows.
The autoplay parameter is "yes", and the video actually starts well, but none of the javascript controls I wrote seem to work.
The Firefox's Error Console reports messages like:
Error: document.getElementsByName("video1").play is not a function
Error: document.getElementById("vlc").play is not a function
Error: vlc.stop is not a function
..is not a function? And then what the heck is it?
Why ???
( )
You can easily find the html source, but anyway it's:
Code: Select all
<html>
<head><title>VLC2.HTML</title></head>
<body>
<h1>VLC2.HTML</h1>
<div align="center">
<table>
<tr>
<td>
<embed type="application/x-vlc-plugin"
name="video1"
id="vlc"
autoplay="yes"
loop="no"
width="400"
height="300"
target="extra/sample.avi"
/>
<div id="info"></div>
</td>
<td>
<script type="text/javascript">
var vlc = document.getElementById("vlc");
if(vlc){
document.getElementById("info").innerHTML = "OK";
} else {
document.getElementById("info").innerHTML = "Undefined";
}
</script>
<br />
<input type="button" onclick='document.video1.Play();' value="Play" /><br>
<input type="button" onclick='document.getElementsByName("video1").play();' value="Play (name)" /><br>
<input type="button" onclick='document.getElementById("vlc").play();return false;' value="Play (id)" /><br>
<input type="button" onclick='document.video1.stop();' value="Stop" /><br>
<input type="button" onclick='document.getElementById("info").innerHTML = document.video1.get_length();' value="Get length" /><br>
</td></tr>
</table>
</div>
</body>
</html>