Hello! As the title says, I have a piece of javascript using onclicks that I'm trying to use with the embedded VLC player to switch webcam feeds by pressing the appropriate button. The code is below (Ip's replaced with #'s). The behavior I want is "press a button -> appropriate webcam feed displayed." What I get (in Firefox 17 anyway) is "press webcam 1 button -> webcam 1 feed displayed -> (after 30 or so seconds) webcam2 feed displayed -> (after another 30 seconds) webcam 3 feed displayed." At webcam 3 the looping seems to stop, thus pressing the button for feed 3 stays on feed three. It seems like the javascript is just executing in sequence, and being very new to this I'm not sure if that should even be happening, let alone how to fix it. If someone could look at the below code and give me a suggestion how to fix my little webpage I'd be grateful. Thanks!
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Draft//EN">
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<embed type="application/x-vlc-plugin"
autoplay="no"
loop="no"
id="vlc"
pluginspage="http://www.videolan.org"
version="VideoLAN.VLCPlugin.2"
width="320"
height="240"
>
</embed>
<br />
<button href="javascript:;" onclick="Cam1()">Webcam 1</button>
<button href="javascript:;" onclick="Cam2()">Webcam 2</button>
<button href="javascript:;" onclick="Cam3()">Webcam 3</button>
<script language="javascript">
var options = new Array ("aspect-ratio=4:3", "--repeat");
var Video1 = vlc.playlist.add("rtsp://###.###.##.###:8081/", "MRL1", options);
var Video2 = vlc.playlist.add("rtsp://###.###.##.###:8082/", "MRL2", options);
var Video3 = vlc.playlist.add("rtsp://###.###.##.###:8084/", "MRL3", options);
function Cam1() {
vlc.playlist.stop();
vlc.playlist.playItem(Video1);
}
function Cam2() {
vlc.playlist.stop();
vlc.playlist.playItem(Video2);
}
function Cam3() {
vlc.playlist.stop();
vlc.playlist.playItem(Video3);
}
</script>
</BODY>
</HTML>