]> git.sesse.net Git - vlc/commitdiff
mozilla: activex: update test.html
authorJean-Paul Saman <jean-paul.saman@m2x.nl>
Thu, 20 May 2010 13:53:23 +0000 (15:53 +0200)
committerJean-Paul Saman <jean-paul.saman@m2x.nl>
Tue, 7 Sep 2010 08:26:37 +0000 (10:26 +0200)
- use VLC MediaPlayer events
- use unix style EOL

projects/activex/test.html
projects/mozilla/test.html

index 4d05ba6c8973446eb4c8881c054f7a7418b8b388..7849f6d0931578c68a8582abed6a861c3549aaab 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
-<HTML>\r
-<TITLE>VLC Plugin test page</TITLE>\r
-\r
-<SCRIPT language="JavaScript"><!--\r
-function init()\r
-{\r
-    if( navigator.appName.indexOf("Microsoft Internet")==-1 )\r
-    {\r
-        onVLCPluginReady()\r
-    }\r
-    else if( document.readyState == 'complete' )\r
-    {\r
-        onVLCPluginReady();\r
-    }\r
-    else\r
-    {\r
-        /* Explorer loads plugins asynchronously */\r
-        document.onreadystatechange=function()\r
-        {\r
-            if( document.readyState == 'complete' )\r
-            {\r
-                onVLCPluginReady();\r
-            }\r
-        }\r
-    }\r
-}\r
-\r
-function getVLC(name)\r
-{\r
-    if (window.document[name])\r
-    {\r
-        return window.document[name];\r
-    }\r
-    if (navigator.appName.indexOf("Microsoft Internet")==-1)\r
-    {\r
-        if (document.embeds && document.embeds[name])\r
-            return document.embeds[name];\r
-    }\r
-    else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)\r
-    {\r
-        return document.getElementById(name);\r
-    }\r
-}\r
-\r
-function onVLCPluginReady()\r
-{\r
-    updateVolume(0);\r
-}\r
-\r
-//--></SCRIPT>\r
-\r
-<BODY onLoad="init();">\r
-<TABLE>\r
-<TR><TD colspan="2">\r
-MRL:\r
-<INPUT size="90" id="targetTextField" value="">\r
-<INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">\r
-<INPUT type=submit value="Add" onClick="doAdd(document.getElementById('targetTextField').value);">\r
-</TD></TR>\r
-<TR><TD align="center" colspan="2">\r
-<!--\r
-Insert VideoLAN.VLCPlugin.2\r
--->\r
-<OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"\r
-        width="640"\r
-        height="480"\r
-        id="vlc"\r
-        events="True">\r
-<param name="MRL" value="" />\r
-<param name="ShowDisplay" value="True" />\r
-<param name="AutoLoop" value="False" />\r
-<param name="AutoPlay" value="False" />\r
-<param name="Volume" value="50" />\r
-<param name="toolbar" value="true" />\r
-<param name="StartTime" value="0" />\r
-<EMBED pluginspage="http://www.videolan.org"\r
-       type="application/x-vlc-plugin"\r
-       version="VideoLAN.VLCPlugin.2"\r
-       width="640"\r
-       height="480"\r
-       toolbar="true"\r
-       text="Waiting for video"\r
-       name="vlc">\r
-</EMBED>\r
-</OBJECT>\r
-</TD></TR>\r
-<TR><TD colspan="2">\r
-<TABLE><TR>\r
-<TD valign="top" width="550">\r
-<!--\r
-Insert Slider widget\r
--->\r
-</TD><TD width="15%">\r
-<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>\r
-<DIV id="state" style="text-align:center">Stopped...</DIV>\r
-</TD></TR></TABLE>\r
-</TD></TR>\r
-<TR><TD>\r
-<INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause();'>\r
-<INPUT type=button value="Stop" onClick='doStop();'>\r
-&nbsp;\r
-<INPUT type=button value=" << " onClick='doPlaySlower();'>\r
-<INPUT type=button value="Reverse" onClick='doReverse();'>\r
-<INPUT type=button value=" >> " onClick='doPlayFaster();'>\r
-&nbsp;\r
-<INPUT type=button value="Fullscreen" onClick='getVLC("vlc").video.toggleFullscreen();'>\r
-<INPUT type=button value="Version" onClick='alert("vlc " + getVLC("vlc").VersionInfo);'>\r
-<INPUT type=button value=" State " onClick='alert("state: " + getVLC("vlc").input.state);'>\r
-</TD><TD align="right">\r
-<SPAN style="text-align:center">Volume:</SPAN>\r
-<INPUT type=button value=" - " onClick='updateVolume(-10)'>\r
-<SPAN id="volumeTextField" style="text-align:center">--</SPAN>\r
-<INPUT type=button value=" + " onClick='updateVolume(+10)'>\r
-<INPUT type=button value="Mute" onClick='getVLC("vlc").audio.toggleMute();'>\r
-</TD>\r
-</TR>\r
-<TR><TD>Playlist:\r
-<INPUT type=button value="Prev" onClick='getVLC("vlc").playlist.prev();'>\r
-<INPUT type=button value="Next" onClick='getVLC("vlc").playlist.next();'>\r
-<INPUT type=button value="Clear All" onClick='doPlaylistClearAll();'>\r
-    Aspect Ratio:\r
-    <SELECT readonly onChange='doAspectRatio(this.value)'>\r
-      <OPTION value="default">Default</OPTION>\r
-      <OPTION value="1:1">1:1</OPTION>\r
-      <OPTION value="4:3">4:3</OPTION>\r
-      <OPTION value="16:9">16:9</OPTION>\r
-      <OPTION value="221:100">221:100</OPTION>\r
-      <OPTION value="5:4">5:4</OPTION>\r
-    </SELECT>\r
-</TD><TD align="right">\r
-<INPUT type=button id="itemCount" value=" Items 0 " onClick='doItemCount();'>\r
-<INPUT size=4 value="" id="removeid"><INPUT type=submit value="Delete" onClick="doRemoveItem(document.getElementById('removeid').value);">\r
-</TD>\r
-</TR>\r
-<TR><TD>Audio Channel:\r
-  <SELECT readonly onClick='doAudioChannel(this.value);'>\r
-    <OPTION value=1>Stereo</OPTION>\r
-    <OPTION value=2>Reverse Stereo</OPTION>\r
-    <OPTION value=3>Left</OPTION>\r
-    <OPTION value=4>Right</OPTION>\r
-    <OPTION value=5>Dolby</OPTION>\r
-  </SELECT>\r
-</TD>\r
-<TD>\r
-<INPUT type=button value="current channel" onClick='alert(getVLC("vlc").audio.channel);'>\r
-</TD>\r
-</TR>\r
-<TR><TD> Audio Track:\r
-<INPUT type=button value=" + " onClick='doAudioTrack(1);'>\r
-<SPAN id="trackTextField" style="text-align:center">--</SPAN>\r
-<INPUT type=button value=" - " onClick='doAudioTrack(-1);'>\r
-<INPUT type=button value="current track" onClick='alert(getVLC("vlc").audio.description(vlc.audio.track));'>\r
-<INPUT type=button value="number of track" onClick='alert(getVLC("vlc").audio.count);'>\r
-</TD>\r
-<TD>\r
-<INPUT type=button value="set slider" onClick='doSetSlider();'>\r
-<INPUT type=button value="get position" onClick='doGetPosition();'>\r
-</TD>\r
-</TR>\r
-<TR>\r
-<TD>Video Subtitle:\r
-    <INPUT type=button value=" + " onClick='doSubtitle(1);'>\r
-    <SPAN id="spuTextField" style="text-align:center">--</SPAN>\r
-    <INPUT type=button value=" - " onClick='doSubtitle(-1);'>\r
-    <INPUT type=button value="current subtitle" onClick='alert(getVLC("vlc").subtitle.description(vlc.subtitle.track));'>\r
-    <INPUT type=button value="number of subtitle" onClick='alert(getVLC("vlc").subtitle.count);'>\r
-</TD>\r
-</TR>\r
-<TR>\r
-<TD>Deinterlacing:\r
-    <INPUT type=button value="BLEND" onClick='getVLC("vlc").video.deinterlace.enable("blend");'>\r
-    <INPUT type=button value="  X  " onClick='getVLC("vlc").video.deinterlace.enable("x");'>\r
-    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.deinterlace.disable();'>\r
-</TD>\r
-</TR>\r
-<TR>\r
-<TD>Marquee video filter:\r
-    <INPUT type=button value="Enable" onClick='getVLC("vlc").video.marquee.enable();'>\r
-    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.marquee.disable();'>\r
-    <INPUT size=4 value="" id="marqueeIntValue">\r
-    <SELECT readonly onClick="doMarqueeOption(this.value,document.getElementById('marqueeIntValue').value);">\r
-        <OPTION value=1>Color</OPTION>\r
-        <OPTION value=2>Opacity</OPTION>\r
-        <OPTION value=3>Position</OPTION>\r
-        <OPTION value=4>Refresh</OPTION>\r
-        <OPTION value=5>Size</OPTION>\r
-        <OPTION value=6>Text</OPTION>\r
-        <OPTION value=7>Timeout</OPTION>\r
-        <OPTION value=8>X</OPTION>\r
-        <OPTION value=9>Y</OPTION>\r
-    </SELECT>\r
-</TD>\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<TITLE>VLC Plugin test page</TITLE>
+<STYLE>
+  .inputTrackerInput {
+        height:20;
+        width:30;
+        font-family : Arial, Helvetica, sans-serif;
+        font-size : 12px;
+  }
+</STYLE>
+
+<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/lib/LibCrossBrowser.js"></SCRIPT>
+<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/lib/EventHandler.js"></SCRIPT>
+<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/core/form/Bs_FormUtil.lib.js"></SCRIPT>
+<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/components/slider/Bs_Slider.class.js"></SCRIPT>
+
+<SCRIPT language="JavaScript"><!--
+function init()
+{
+    inputTracker = new Bs_Slider();
+    if (inputTracker)
+    {
+        inputTracker.attachOnChange(onInputTrackerChange);
+        inputTracker.attachOnSlideStart(onInputTrackerScrollStart);
+        inputTracker.attachOnSlideEnd(onInputTrackerScrollEnd);
+        inputTracker.width         = 530;
+        inputTracker.height        = 15;
+        inputTracker.minVal        = 0;
+        inputTracker.maxVal        = 1.0;
+        inputTracker.valueDefault  = 0;
+        inputTracker.valueInterval = 1/530;
+        inputTracker.setDisabled(true);
+        inputTracker.imgDir   = 'blueshoes-4.5/javascript/components/slider/img/';
+        inputTracker.setBackgroundImage('aluminumalloyvolcanic/horizontal_background.gif', 'repeat');
+        inputTracker.setArrowIconLeft('aluminumalloyvolcanic/horizontal_backgroundLeft.gif', 2, 19);
+        inputTracker.setArrowIconRight('aluminumalloyvolcanic/horizontal_backgroundRight.gif', 2, 19);
+        inputTracker.setSliderIcon('aluminumalloyvolcanic/horizontal_knob.gif', 15, 19);
+        inputTracker.useInputField = 0;
+        inputTracker.draw('inputTrackerDiv');
+    }
+
+    if( navigator.appName.indexOf("Microsoft Internet")==-1 )
+    {
+        onVLCPluginReady()
+    }
+    else if( document.readyState == 'complete' )
+    {
+        onVLCPluginReady();
+    }
+    else
+    {
+        /* Explorer loads plugins asynchronously */
+        document.onreadystatechange=function()
+        {
+            if( document.readyState == 'complete' )
+            {
+                onVLCPluginReady();
+            }
+        }
+    }
+}
+
+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);
+    }
+}
+
+function registerVLCEvent(event, handler)
+{
+    var vlc = getVLC("vlc");
+
+    if (vlc) {
+        if (vlc.attachEvent) {
+            // Microsoft
+            vlc.attachEvent (event, handler);
+        } else if (vlc.addEventListener) {
+            // Mozilla: DOM level 2
+            vlc.addEventListener (event, handler, true);
+        } else {
+            // DOM level 0
+            eval("vlc.on" + event + " = handler");
+        }
+    }
+}
+
+function unregisterVLCEvent(event, handler)
+{
+    var vlc = getVLC("vlc");
+
+    if (vlc) {
+        if (vlc.detachEvent) {
+            // Microsoft
+            vlc.detachEvent (event, handler);
+        } else if (vlc.removeEventListener) {
+            // Mozilla: DOM level 2
+            vlc.removeEventListener (event, handler, true);
+        } else {
+            // DOM level 0
+            eval("vlc.on" + event + " = null");
+        }
+    }
+}
+
+// JS VLC API callbacks
+function handleMediaPlayerMediaChanged()
+{
+    document.getElementById("info").innerHTML = "Media Changed";
+}
+
+function handle_MediaPlayerNothingSpecial()
+{
+    document.getElementById("state").innerHTML = "Idle...";
+}
+
+function handle_MediaPlayerOpening()
+{
+    onOpen();
+}
+
+function handle_MediaPlayerBuffering(val)
+{
+    document.getElementById("info").innerHTML = val + "%";
+}
+
+function handle_MediaPlayerPlaying()
+{
+    onPlay();
+}
+
+function handle_MediaPlayerPaused()
+{
+    onPause();
+}
+
+function handle_MediaPlayerStopped()
+{
+    onStop();
+}
+
+function handle_MediaPlayerForward()
+{
+    document.getElementById("state").innerHTML = "Forward...";
+}
+
+function handle_MediaPlayerBackward()
+{
+    document.getElementById("state").innerHTML = "Backward...";
+}
+
+function handle_MediaPlayerEndReached()
+{
+    onEnd();
+}
+
+function handle_MediaPlayerEncounteredError()
+{
+    onError();
+}
+
+function handle_MediaPlayerTimeChanged(time)
+{
+    var vlc = getVLC("vlc");
+    var info = document.getElementById("info");
+    if( vlc )
+    {
+        var mediaLen = vlc.input.length;
+        if( mediaLen > 0 )
+        {
+            // seekable media
+            info.innerHTML = formatTime(time)+"/"+formatTime(mediaLen);
+        }
+    }
+}
+
+function handle_MediaPlayerPositionChanged(val)
+{
+    // set javascript slider to correct position
+}
+
+function handle_MediaPlayerSeekableChanged(val)
+{
+    setSeekable(val);
+}
+
+function handle_MediaPlayerPausableChanged(val)
+{
+    setPauseable(val);
+}
+
+function handle_MediaPlayerTitleChanged(val)
+{
+    //setTitle(val);
+    document.getElementById("info").innerHTML = "Title: " + val;
+}
+
+function handle_MediaPlayerLengthChanged(val)
+{
+    //setMediaLength(val);
+}
+
+// VLC Plugin
+function onVLCPluginReady()
+{
+    registerVLCEvent("MediaPlayerMediaChanged", handleMediaPlayerMediaChanged);
+    registerVLCEvent("MediaPlayerNothingSpecial", handle_MediaPlayerNothingSpecial);
+    registerVLCEvent("MediaPlayerOpening", handle_MediaPlayerOpening);
+    registerVLCEvent("MediaPlayerBuffering", handle_MediaPlayerBuffering);
+    registerVLCEvent("MediaPlayerPlaying", handle_MediaPlayerPlaying);
+    registerVLCEvent("MediaPlayerPaused", handle_MediaPlayerPaused);
+    registerVLCEvent("MediaPlayerStopped", handle_MediaPlayerStopped);
+    registerVLCEvent("MediaPlayerForward", handle_MediaPlayerForward);
+    registerVLCEvent("MediaPlayerBackward", handle_MediaPlayerBackward);
+    registerVLCEvent("MediaPlayerEndReached", handle_MediaPlayerEndReached);
+    registerVLCEvent("MediaPlayerEncounteredError", handle_MediaPlayerEncounteredError);
+    registerVLCEvent("MediaPlayerTimeChanged", handle_MediaPlayerTimeChanged);
+    registerVLCEvent("MediaPlayerPositionChanged", handle_MediaPlayerPositionChanged);
+    registerVLCEvent("MediaPlayerSeekableChanged", handle_MediaPlayerSeekableChanged);
+    registerVLCEvent("MediaPlayerPausableChanged", handle_MediaPlayerPausableChanged);
+    registerVLCEvent("MediaPlayerTitleChanged", handle_MediaPlayerTitleChanged);
+    registerVLCEvent("MediaPlayerLengthChanged", handle_MediaPlayerLengthChanged);
+}
+
+function close()
+{
+    unregisterVLCEvent('MediaPlayerMouseGrab', handleMouseGrab);
+    unregisterVLCEvent('MediaPlayerMouseRelease', handleMouseRelease);
+    unregisterVLCEvent('MediaPlayerMouseClick', handleMouseClick);
+
+    unregisterVLCEvent("MediaPlayerMediaChanged", handleMediaPlayerMediaChanged);
+    unregisterVLCEvent("MediaPlayerNothingSpecial", handle_MediaPlayerNothingSpecial);
+    unregisterVLCEvent("MediaPlayerOpening", handle_MediaPlayerOpening);
+    unregisterVLCEvent("MediaPlayerBuffering", handle_MediaPlayerBuffering);
+    unregisterVLCEvent("MediaPlayerPlaying", handle_MediaPlayerPlaying);
+    unregisterVLCEvent("MediaPlayerPaused", handle_MediaPlayerPaused);
+    unregisterVLCEvent("MediaPlayerStopped", handle_MediaPlayerStopped);
+    unregisterVLCEvent("MediaPlayerForward", handle_MediaPlayerForward);
+    unregisterVLCEvent("MediaPlayerBackward", handle_MediaPlayerBackward);
+    unregisterVLCEvent("MediaPlayerEndReached", handle_MediaPlayerEndReached);
+    unregisterVLCEvent("MediaPlayerEncounteredError", handle_MediaPlayerEncounteredError);
+    unregisterVLCEvent("MediaPlayerTimeChanged", handle_MediaPlayerTimeChanged);
+    unregisterVLCEvent("MediaPlayerPositionChanged", handle_MediaPlayerPositionChanged);
+    unregisterVLCEvent("MediaPlayerSeekableChanged", handle_MediaPlayerSeekableChanged);
+    unregisterVLCEvent("MediaPlayerPausableChanged", handle_MediaPlayerPausableChanged);
+    unregisterVLCEvent("MediaPlayerTitleChanged", handle_MediaPlayerTitleChanged);
+    unregisterVLCEvent("MediaPlayerLengthChanged", handle_MediaPlayerLengthChanged);
+}
+
+//--></SCRIPT>
+
+<BODY onLoad="init();" onClose="close();>
+<TABLE>
+<TR><TD colspan="2">
+MRL:
+<INPUT size="90" id="targetTextField" value="">
+<INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">
+<INPUT type=submit value="Add" onClick="doAdd(document.getElementById('targetTextField').value);">
+</TD></TR>
+<TR><TD align="center" colspan="2">
+<!--
+Insert VideoLAN.VLCPlugin.2
+-->
+<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="toolbar" value="true" />
+<param name="StartTime" value="0" />
+<EMBED pluginspage="http://www.videolan.org"
+       type="application/x-vlc-plugin"
+       version="VideoLAN.VLCPlugin.2"
+       width="640"
+       height="480"
+       toolbar="true"
+       text="Waiting for video"
+       name="vlc">
+</EMBED>
+</OBJECT>
+</TD></TR>
+<TR><TD colspan="2">
+<TABLE><TR>
+<TD valign="top" width="550">
+<!--
+Insert Slider widget
+-->
+<DIV id="inputTrackerDiv"</DIV>
+</TD><TD width="15%">
+<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
+<DIV id="state" style="text-align:center">Stopped...</DIV>
+</TD></TR></TABLE>
+</TD></TR>
+<TR><TD>
+<INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause();'>
+<INPUT type=button value="Stop" onClick='doStop();'>
+&nbsp;
+<INPUT type=button value=" << " onClick='doPlaySlower();'>
+<INPUT type=button value="Reverse" onClick='doReverse();'>
+<INPUT type=button value=" >> " onClick='doPlayFaster();'>
+&nbsp;
+<INPUT type=button value="Fullscreen" onClick='getVLC("vlc").video.toggleFullscreen();'>
+<INPUT type=button value="Version" onClick='alert("vlc " + getVLC("vlc").VersionInfo);'>
+<INPUT type=button value=" State " onClick='alert("state: " + getVLC("vlc").input.state);'>
+</TD><TD align="right">
+<SPAN style="text-align:center">Volume:</SPAN>
+<INPUT type=button value=" - " onClick='updateVolume(-10)'>
+<SPAN id="volumeTextField" style="text-align:center">--</SPAN>
+<INPUT type=button value=" + " onClick='updateVolume(+10)'>
+<INPUT type=button value="Mute" onClick='getVLC("vlc").audio.toggleMute();'>
+</TD>
+</TR>
+<TR><TD>Playlist:
+<INPUT type=button value="Prev" onClick='getVLC("vlc").playlist.prev();'>
+<INPUT type=button value="Next" onClick='getVLC("vlc").playlist.next();'>
+<INPUT type=button value="Clear All" onClick='doPlaylistClearAll();'>
+    Aspect Ratio:
+    <SELECT readonly onChange='doAspectRatio(this.value)'>
+      <OPTION value="default">Default</OPTION>
+      <OPTION value="1:1">1:1</OPTION>
+      <OPTION value="4:3">4:3</OPTION>
+      <OPTION value="16:9">16:9</OPTION>
+      <OPTION value="221:100">221:100</OPTION>
+      <OPTION value="5:4">5:4</OPTION>
+    </SELECT>
+</TD><TD align="right">
+<INPUT type=button id="itemCount" value=" Items 0 " onClick='doItemCount();'>
+<INPUT size=4 value="" id="removeid"><INPUT type=submit value="Delete" onClick="doRemoveItem(document.getElementById('removeid').value);">
+</TD>
+</TR>
+<TR><TD>Audio Channel:
+  <SELECT readonly onClick='doAudioChannel(this.value);'>
+    <OPTION value=1>Stereo</OPTION>
+    <OPTION value=2>Reverse Stereo</OPTION>
+    <OPTION value=3>Left</OPTION>
+    <OPTION value=4>Right</OPTION>
+    <OPTION value=5>Dolby</OPTION>
+  </SELECT>
+</TD>
+<TD>
+<INPUT type=button value="current channel" onClick='alert(getVLC("vlc").audio.channel);'>
+</TD>
+</TR>
+<TR><TD> Audio Track:
+<INPUT type=button value=" + " onClick='doAudioTrack(1);'>
+<SPAN id="trackTextField" style="text-align:center">--</SPAN>
+<INPUT type=button value=" - " onClick='doAudioTrack(-1);'>
+<INPUT type=button value="current track" onClick='alert(getVLC("vlc").audio.description(vlc.audio.track));'>
+<INPUT type=button value="number of track" onClick='alert(getVLC("vlc").audio.count);'>
+</TD>
+<TD>
+<INPUT type=button value="set slider" onClick='doSetSlider();'>
+<INPUT type=button value="get position" onClick='doGetPosition();'>
+</TD>
+</TR>
+<TR>
+<TD>Video Subtitle:
+    <INPUT type=button value=" + " onClick='doSubtitle(1);'>
+    <SPAN id="spuTextField" style="text-align:center">--</SPAN>
+    <INPUT type=button value=" - " onClick='doSubtitle(-1);'>
+    <INPUT type=button value="current subtitle" onClick='alert(getVLC("vlc").subtitle.description(vlc.subtitle.track));'>
+    <INPUT type=button value="number of subtitle" onClick='alert(getVLC("vlc").subtitle.count);'>
+</TD>
+</TR>
+<TR>
+<TD>Deinterlacing:
+    <INPUT type=button value="BLEND" onClick='getVLC("vlc").video.deinterlace.enable("blend");'>
+    <INPUT type=button value="  X  " onClick='getVLC("vlc").video.deinterlace.enable("x");'>
+    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.deinterlace.disable();'>
+</TD>
+</TR>
+<TR>
+<TD>Marquee video filter:
+    <INPUT type=button value="Enable" onClick='getVLC("vlc").video.marquee.enable();'>
+    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.marquee.disable();'>
+    <INPUT size=4 value="" id="marqueeIntValue">
+    <SELECT readonly onClick="doMarqueeOption(this.value,document.getElementById('marqueeIntValue').value);">
+        <OPTION value=1>Color</OPTION>
+        <OPTION value=2>Opacity</OPTION>
+        <OPTION value=3>Position</OPTION>
+        <OPTION value=4>Refresh</OPTION>
+        <OPTION value=5>Size</OPTION>
+        <OPTION value=6>Text</OPTION>
+        <OPTION value=7>Timeout</OPTION>
+        <OPTION value=8>X</OPTION>
+        <OPTION value=9>Y</OPTION>
+    </SELECT>
+</TD>
 </TR>
-<TR>\r
-<TD>Logo video filter:\r
-    <INPUT type=button value="Enable" onClick='getVLC("vlc").video.logo.enable();'>\r
-    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.logo.disable();'>\r
-    <INPUT size=4 value="" id="logoIntValue">\r
-    <SELECT readonly onClick="doLogoOption(this.value,document.getElementById('logoIntValue').value);">\r
-        <OPTION value=1>File</OPTION>\r
-        <OPTION value=2>Position</OPTION>\r
-        <OPTION value=3>Opacity</OPTION>\r
-        <OPTION value=4>Repeat</OPTION>\r
-        <OPTION value=5>Delay</OPTION>\r
-        <OPTION value=6>X</OPTION>\r
+<TR>
+<TD>Logo video filter:
+    <INPUT type=button value="Enable" onClick='getVLC("vlc").video.logo.enable();'>
+    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.logo.disable();'>
+    <INPUT size=4 value="" id="logoIntValue">
+    <SELECT readonly onClick="doLogoOption(this.value,document.getElementById('logoIntValue').value);">
+        <OPTION value=1>File</OPTION>
+        <OPTION value=2>Position</OPTION>
+        <OPTION value=3>Opacity</OPTION>
+        <OPTION value=4>Repeat</OPTION>
+        <OPTION value=5>Delay</OPTION>
+        <OPTION value=6>X</OPTION>
         <OPTION value=7>Y</OPTION>
-    </SELECT>\r
-</TD>\r
-</TR>\r\r
-<TR>\r
-<TD>\r
-    <INPUT type=button id="telx" value="Teletext off" onClick='doToggleTeletext();'>\r
-    Teletext page:\r
-    <INPUT size=4 value="100" id="telxPage" onClick='doTelxPage(document.getElementById("telxPage").value);'>\r
-</TD>\r
-</TR>\r
-</TABLE>\r
-<SCRIPT language="javascript">\r
-<!--\r
-\r
-var rate = 0;\r
-var prevState = 0;\r
-var telxState = false;\r
-\r
-function doSetSlider()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    // set slider to new position\r
-    if( vlc )\r
-        vlc.input.time = (vlc.input.length/2);\r
-}\r
-\r
-function doGetPosition()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    // set slider to new position\r
-    if (vlc)\r
-        alert( "position is " + vlc.input.time);\r
-}\r
-\r
-function doReverse(rate)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.input.rate = -1.0 * vlc.input.rate;\r
-}\r
-\r
-function doAudioChannel(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.audio.channel = parseInt(value);\r
-}\r
-\r
-function doAudioTrack(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        vlc.audio.track = vlc.audio.track + value;\r
-        document.getElementById("trackTextField").innerHTML = vlc.audio.track;\r
-    }\r
-}\r
-\r
-function doAspectRatio(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.video.aspectRatio = value;\r
-}\r
-\r
-function doSubtitle(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        vlc.subtitle.track = vlc.subtitle.track + value;\r
-        document.getElementById("spuTextField").innerHTML = vlc.subtitle.track;\r
-    }\r
-}\r
-\r
-function doTelxPage(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.video.teletext = parseInt(value);\r
-}\r
-\r
-function doToggleTeletext()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    if( vlc )\r
-    {\r
-        vlc.video.toggleTeletext();\r
-        if (telxState)\r
-        {\r
-            document.getElementById("telx").innerHTML = "Teletext on";\r
-            telxState = true;\r
-        }\r
-        else\r
-        {\r
-            document.getElementById("telx").innerHTML = "Teletext off";\r
-            telxState = false;\r
-        }\r
-    }\r
-}\r
-\r
-function doItemCount()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        var count = vlc.playlist.items.count;\r
-        document.getElementById("itemCount").value = " Items " + count + " ";\r
-    }\r
-}\r
-\r
-function doRemoveItem(item)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.playlist.items.remove(item);\r
-}\r
-\r
-function doPlaylistClearAll()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        vlc.playlist.items.clear();\r
-        while( vlc.playlist.items.count > 0)\r
-        {\r
-            // wait till playlist empties.\r
-        }\r
-        doItemCount();\r
-    }\r
-}\r
-\r
-function updateVolume(deltaVol)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        vlc.audio.volume += deltaVol;\r
-        document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";\r
-    }\r
-}\r
-\r
-function formatTime(timeVal)\r
-{\r
-    if( typeof timeVal != 'number' )\r
-        return "-:--:--";\r
-\r
-    var timeHour = Math.round(timeVal / 1000);\r
-    var timeSec = timeHour % 60;\r
-    if( timeSec < 10 )\r
-        timeSec = '0'+timeSec;\r
-    timeHour = (timeHour - timeSec)/60;\r
-    var timeMin = timeHour % 60;\r
-    if( timeMin < 10 )\r
-        timeMin = '0'+timeMin;\r
-    timeHour = (timeHour - timeMin)/60;\r
-    if( timeHour > 0 )\r
-        return timeHour+":"+timeMin+":"+timeSec;\r
-    else\r
-        return timeMin+":"+timeSec;\r
-}\r
-\r
-function doState()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    var newState = 0;\r
-\r
-    if( vlc )\r
-        newState = vlc.input.state;\r
-\r
-    if( newState == 0 )\r
-    {\r
-        // current media has stopped\r
-        onEnd();\r
-    }\r
-    else if( newState == 1 )\r
-    {\r
-        // current media is openning/connecting\r
-        onOpen();\r
-    }\r
-    else if( newState == 2 )\r
-    {\r
-        // current media is buffering data\r
-        onBuffer();\r
-    }\r
-    else if( newState == 3 )\r
-    {\r
-        // current media is now playing\r
-        onPlay();\r
-    }\r
-    else if( newState == 4 )\r
-    {\r
-        // current media is now paused\r
-        onPause();\r
-    }\r
-    else if( newState == 5 )\r
-    {\r
-        // current media has stopped\r
-        onStop();\r
-    }\r
-    else if( newState == 6 )\r
-    {\r
-        // current media has ended\r
-        onEnd();\r
-    }\r
-    else if( newState == 7 )\r
-    {\r
-        // current media encountered error\r
-        onError();\r
-    }\r
-}\r
-\r
-function monitor()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    var newState = 0;\r
-\r
-    if( vlc )\r
-    {\r
-        newState = vlc.input.state;\r
-    }\r
-\r
-    if( prevState != newState )\r
-    {\r
-        if( newState == 0 )\r
-        {\r
-            // current media has stopped\r
-            onEnd();\r
-        }\r
-        else if( newState == 1 )\r
-        {\r
-            // current media is openning/connecting\r
-            onOpen();\r
-        }\r
-        else if( newState == 2 )\r
-        {\r
-            // current media is buffering data\r
-            onBuffer();\r
-        }\r
-        else if( newState == 3 )\r
-        {\r
-            // current media is now playing\r
-            onPlay();\r
-        }\r
-        else if( newState == 4 )\r
-        {\r
-            // current media is now paused\r
-            onPause();\r
-        }\r
-        else if( newState == 5 )\r
-        {\r
-            // current media has stopped\r
-                onStop();\r
-        }\r
-        else if( newState == 6 )\r
-        {\r
-            // current media has ended\r
-            onEnd();\r
-        }\r
-        else if( newState == 7 )\r
-        {\r
-            // current media encountered error\r
-            onError();\r
-        }\r
-        prevState = newState;\r
-    }\r
-    else if( newState == 3 )\r
-    {\r
-        // current media is playing\r
-        onPlaying();\r
-    }\r
-};\r
-\r
-/* actions */\r
-\r
-function doGo(targetURL)\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    if( vlc )\r
-    {\r
-        vlc.playlist.items.clear();\r
-        while( vlc.playlist.items.count > 0 )\r
-        {\r
-            // clear() may return before the playlist has actually been cleared\r
-            // just wait for it to finish its job\r
-        }\r
-        var options = [":rtsp-tcp"];\r
-        var itemId = vlc.playlist.add(targetURL,"",options);\r
-        options = [];\r
-        if( itemId != -1 )\r
-        {\r
-            // play MRL\r
-            vlc.playlist.playItem(itemId);\r
-            monitor();\r
-        }\r
-        else\r
-        {\r
-            alert("cannot play at the moment !");\r
-        }\r
-        doItemCount();\r
-    }\r
-}\r
-\r
-function doAdd(targetURL)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    var options = [":vout-filter=deinterlace", ":deinterlace-mode=linear"];\r
-    if( vlc )\r
-    {\r
-        vlc.playlist.add(targetURL, "", options);\r
-        options = [];\r
-        doItemCount();\r
-    }\r
-}\r
-\r
-function doPlayOrPause()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        if( vlc.playlist.isPlaying )\r
-        {\r
-            vlc.playlist.togglePause();\r
-            monitor();\r
-        }\r
-        else if( vlc.playlist.items.count > 0 )\r
-        {\r
-            vlc.playlist.play();\r
-            monitor();\r
-        }\r
-        else\r
-        {\r
-            alert('nothing to play !');\r
-        }\r
-    }\r
-}\r
-\r
-function doStop()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    if( vlc )\r
-        vlc.playlist.stop();\r
-\r
-    onStop();\r
-}\r
-\r
-function doPlaySlower()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.input.rate = vlc.input.rate / 2;\r
-}\r
-\r
-function doPlayFaster()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.input.rate = vlc.input.rate * 2;\r
-}\r
-\r
-/* events */\r
-\r
-function onOpen()\r
-{\r
-    document.getElementById("state").innerHTML = "Opening...";\r
-    document.getElementById("PlayOrPause").value = "Pause";\r
-}\r
-\r
-function onBuffer()\r
-{\r
-    document.getElementById("state").innerHTML = "Buffering...";\r
-    document.getElementById("PlayOrPause").value = "Pause";\r
-}\r
-\r
-function onPlay()\r
-{\r
-    document.getElementById("state").innerHTML = "Playing...";\r
-    document.getElementById("PlayOrPause").value = "Pause";\r
-    onPlaying();\r
-}\r
-\r
-function onEnd()\r
-{\r
-    document.getElementById("state").innerHTML = "End...";\r
-    doStop();\r
-}\r
-\r
-var liveFeedText = ["Live", "((Live))", "(( Live ))", "((  Live  ))"];\r
-var liveFeedRoll = 0;\r
-\r
-function onPlaying()\r
-{\r
-        var vlc = getVLC("vlc");\r
-        var info = document.getElementById("info");\r
-        if( vlc )\r
-        {\r
-            var mediaLen = vlc.input.length;\r
-            if( mediaLen > 0 )\r
-            {\r
-                info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(mediaLen);\r
-            }\r
-            else\r
-            {\r
-                // non-seekable "live" media\r
-                liveFeedRoll = liveFeedRoll & 3;\r
-                info.innerHTML = liveFeedText[liveFeedRoll++];\r
-            }\r
-        }\r
-    }\r
-}\r
-\r
-function onPause()\r
-{\r
-    document.getElementById("state").innerHTML = "Paused...";\r
-    document.getElementById("PlayOrPause").value = " Play ";\r
-}\r
-\r
-function onStop()\r
-{\r
-    document.getElementById("info").innerHTML = "-:--:--/-:--:--";\r
-    document.getElementById("state").innerHTML = "Stopped...";\r
-    document.getElementById("PlayOrPause").value = " Play ";\r
-}\r
-\r
-function onError()\r
-{\r
-    document.getElementById("state").innerHTML = "Error...";\r
-}\r
-\r
-function doMarqueeOption(option, value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    val = parseInt(value);\r
-    if( vlc )\r
-    {\r
-        if (option == 1)\r
-            vlc.video.marquee.color = val;\r
-        if (option == 2)\r
-            vlc.video.marquee.opacity = val;\r
-        if (option == 3)\r
-            vlc.video.marquee.position = value;\r
-        if (option == 4)\r
-            vlc.video.marquee.refresh = val;\r
-        if (option == 5)\r
-            vlc.video.marquee.size = val;\r
-        if (option == 6)\r
-            vlc.video.marquee.text = value;\r
-        if (option == 7)\r
-            vlc.video.marquee.timeout = val;\r
-        if (option == 8)\r
-            vlc.video.marquee.x = val;\r
-        if (option == 9)\r
-            vlc.video.marquee.y = val;\r
-    }\r
-}\r
-
-function doLogoOption(option, value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        if (option == 1)\r
-            vlc.video.logo.file(value);\r
-        if (option == 2)\r
-            vlc.video.logo.position = value;\r
-        val = parseInt(value);\r
-        if (option == 3)\r
-            vlc.video.logo.opacity = val;\r
-        if (option == 4)\r
-            vlc.video.logo.repeat = val;\r
-        if (option == 5)\r
-            vlc.video.logo.delay = val;\r
-        if (option == 6)\r
-            vlc.video.logo.x = val;\r
-        if (option == 7)\r
-            vlc.video.logo.y = val;\r
-    }\r
-}\r
-\r
-//-->\r
-</SCRIPT>\r
-</BODY>\r
-</HTML>\r
+    </SELECT>
+</TD>
+</TR>
+<TR>
+<TD>
+    <INPUT type=button id="telx" value="Teletext off" onClick='doToggleTeletext();'>
+    Teletext page:
+    <INPUT size=4 value="100" id="telxPage" onClick='doTelxPage(document.getElementById("telxPage").value);'>
+</TD>
+</TR>
+</TABLE>
+<SCRIPT language="javascript">
+<!--
+
+var rate = 0;
+var prevState = 0;
+var monitorTimerId = 0;
+var inputTracker;
+var inputTrackerScrolling = false;
+var inputTrackerIgnoreChange = false;
+var telxState = false;
+var canPause = true;
+var canSeek = true;
+
+function setPauseable(val)
+{
+    canPause = val;
+}
+
+function setSeekable(val)
+{
+    canSeek = val;
+}
+
+function doSetSlider()
+{
+    var vlc = getVLC("vlc");
+
+    // set slider to new position
+    if( vlc )
+        vlc.input.time = (vlc.input.length/2);
+}
+
+function doGetPosition()
+{
+    var vlc = getVLC("vlc");
+
+    // set slider to new position
+    if (vlc)
+        alert( "position is " + vlc.input.time);
+}
+
+function doReverse(rate)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.input.rate = -1.0 * vlc.input.rate;
+}
+
+function doAudioChannel(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.audio.channel = parseInt(value);
+}
+
+function doAudioTrack(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        vlc.audio.track = vlc.audio.track + value;
+        document.getElementById("trackTextField").innerHTML = vlc.audio.track;
+    }
+}
+
+function doAspectRatio(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.video.aspectRatio = value;
+}
+
+function doSubtitle(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        vlc.subtitle.track = vlc.subtitle.track + value;
+        document.getElementById("spuTextField").innerHTML = vlc.subtitle.track;
+    }
+}
+
+function doTelxPage(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.video.teletext = parseInt(value);
+}
+
+function doToggleTeletext()
+{
+    var vlc = getVLC("vlc");
+
+    if( vlc )
+    {
+        vlc.video.toggleTeletext();
+        if (telxState)
+        {
+            document.getElementById("telx").innerHTML = "Teletext on";
+            telxState = true;
+        }
+        else
+        {
+            document.getElementById("telx").innerHTML = "Teletext off";
+            telxState = false;
+        }
+    }
+}
+
+function doItemCount()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        var count = vlc.playlist.items.count;
+        document.getElementById("itemCount").value = " Items " + count + " ";
+    }
+}
+
+function doRemoveItem(item)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.playlist.items.remove(item);
+}
+
+function doPlaylistClearAll()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        vlc.playlist.items.clear();
+        while( vlc.playlist.items.count > 0)
+        {
+            // wait till playlist empties.
+        }
+        doItemCount();
+    }
+}
+
+function updateVolume(deltaVol)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        vlc.audio.volume += deltaVol;
+        document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
+    }
+}
+
+function formatTime(timeVal)
+{
+    if( typeof timeVal != 'number' )
+        return "-:--:--";
+
+    var timeHour = Math.round(timeVal / 1000);
+    var timeSec = timeHour % 60;
+    if( timeSec < 10 )
+        timeSec = '0'+timeSec;
+    timeHour = (timeHour - timeSec)/60;
+    var timeMin = timeHour % 60;
+    if( timeMin < 10 )
+        timeMin = '0'+timeMin;
+    timeHour = (timeHour - timeMin)/60;
+    if( timeHour > 0 )
+        return timeHour+":"+timeMin+":"+timeSec;
+    else
+        return timeMin+":"+timeSec;
+}
+
+function doState()
+{
+    var vlc = getVLC("vlc");
+    var newState = 0;
+
+    if( vlc )
+        newState = vlc.input.state;
+
+    if( newState == 0 )
+    {
+        // current media has stopped
+        onEnd();
+    }
+    else if( newState == 1 )
+    {
+        // current media is openning/connecting
+        onOpen();
+    }
+    else if( newState == 2 )
+    {
+        // current media is buffering data
+        onBuffer();
+    }
+    else if( newState == 3 )
+    {
+        // current media is now playing
+        onPlay();
+    }
+    else if( newState == 4 )
+    {
+        // current media is now paused
+        onPause();
+    }
+    else if( newState == 5 )
+    {
+        // current media has stopped
+        onStop();
+    }
+    else if( newState == 6 )
+    {
+        // current media has ended
+        onEnd();
+    }
+    else if( newState == 7 )
+    {
+        // current media encountered error
+        onError();
+    }
+}
+
+function monitor()
+{
+    var vlc = getVLC("vlc");
+    var newState = 0;
+
+    if( vlc )
+    {
+        newState = vlc.input.state;
+    }
+
+    if( prevState != newState )
+    {
+        if( newState == 0 )
+        {
+            // current media has stopped
+            onEnd();
+        }
+        else if( newState == 1 )
+        {
+            // current media is openning/connecting
+            onOpen();
+        }
+        else if( newState == 2 )
+        {
+            // current media is buffering data
+            onBuffer();
+        }
+        else if( newState == 3 )
+        {
+            // current media is now playing
+            onPlay();
+        }
+        else if( newState == 4 )
+        {
+            // current media is now paused
+            onPause();
+        }
+        else if( newState == 5 )
+        {
+            // current media has stopped
+            onStop();
+        }
+        else if( newState == 6 )
+        {
+            // current media has ended
+            onEnd();
+        }
+        else if( newState == 7 )
+        {
+            // current media encountered error
+            onError();
+        }
+        prevState = newState;
+    }
+    else if( newState == 3 )
+    {
+        // current media is playing
+        onPlaying();
+    }
+    if( monitorTimerId == 0 )
+    {
+        monitorTimerId = setInterval("monitor()", 1000);
+    }
+};
+
+/* actions */
+
+function doGo(targetURL)
+{
+    var vlc = getVLC("vlc");
+
+    if( vlc )
+    {
+        vlc.playlist.items.clear();
+        while( vlc.playlist.items.count > 0 )
+        {
+            // clear() may return before the playlist has actually been cleared
+            // just wait for it to finish its job
+        }
+        var options = [":rtsp-tcp"];
+        var itemId = vlc.playlist.add(targetURL,"",options);
+        options = [];
+        if( itemId != -1 )
+        {
+            // play MRL
+            vlc.playlist.playItem(itemId);
+            if( monitorTimerId == 0 )
+            {
+                monitor();
+            }
+        }
+        else
+        {
+            alert("cannot play at the moment !");
+        }
+        doItemCount();
+    }
+}
+
+function doAdd(targetURL)
+{
+    var vlc = getVLC("vlc");
+    var options = [":vout-filter=deinterlace", ":deinterlace-mode=linear"];
+    if( vlc )
+    {
+        vlc.playlist.add(targetURL, "", options);
+        options = [];
+        doItemCount();
+    }
+}
+
+function doPlayOrPause()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        if( vlc.playlist.isPlaying && canPause )
+        {
+            vlc.playlist.togglePause();
+            //monitor();
+        }
+        else if( vlc.playlist.items.count > 0 )
+        {
+            vlc.playlist.play();
+            //monitor();
+        }
+        else
+        {
+            alert('nothing to play !');
+        }
+    }
+}
+
+function doStop()
+{
+    var vlc = getVLC("vlc");
+
+    if( vlc )
+        vlc.playlist.stop();
+
+    if( monitorTimerId != 0 )
+    {
+        clearInterval(monitorTimerId);
+        monitorTimerId = 0;
+    }
+    onStop();
+}
+
+function doPlaySlower()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.input.rate = vlc.input.rate / 2;
+}
+
+function doPlayFaster()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.input.rate = vlc.input.rate * 2;
+}
+
+function doMarqueeOption(option, value)
+{
+    var vlc = getVLC("vlc");
+    val = parseInt(value);
+    if( vlc )
+    {
+        if (option == 1)
+            vlc.video.marquee.color = val;
+        if (option == 2)
+            vlc.video.marquee.opacity = val;
+        if (option == 3)
+            vlc.video.marquee.position = value;
+        if (option == 4)
+            vlc.video.marquee.refresh = val;
+        if (option == 5)
+            vlc.video.marquee.size = val;
+        if (option == 6)
+            vlc.video.marquee.text = value;
+        if (option == 7)
+            vlc.video.marquee.timeout = val;
+        if (option == 8)
+            vlc.video.marquee.x = val;
+        if (option == 9)
+            vlc.video.marquee.y = val;
+    }
+}
+
+function doLogoOption(option, value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        if (option == 1)
+            vlc.video.logo.file(value);
+        if (option == 2)
+            vlc.video.logo.position = value;
+        val = parseInt(value);
+        if (option == 3)
+            vlc.video.logo.opacity = val;
+        if (option == 4)
+            vlc.video.logo.repeat = val;
+        if (option == 5)
+            vlc.video.logo.delay = val;
+        if (option == 6)
+            vlc.video.logo.x = val;
+        if (option == 7)
+            vlc.video.logo.y = val;
+    }
+}
+
+/* events */
+
+function onOpen()
+{
+    document.getElementById("state").innerHTML = "Opening...";
+    document.getElementById("PlayOrPause").value = "Pause";
+}
+
+function onBuffer()
+{
+    document.getElementById("state").innerHTML = "Buffering...";
+    document.getElementById("PlayOrPause").value = "Pause";
+}
+
+function onPlay()
+{
+    document.getElementById("state").innerHTML = "Playing...";
+    document.getElementById("PlayOrPause").value = "Pause";
+    onPlaying();
+}
+
+function onEnd()
+{
+    document.getElementById("state").innerHTML = "End...";
+}
+
+var liveFeedText = ["Live", "((Live))", "(( Live ))", "((  Live  ))"];
+var liveFeedRoll = 0;
+
+function onPlaying()
+{
+    if( !inputTrackerScrolling )
+    {
+        var vlc = getVLC("vlc");
+        var info = document.getElementById("info");
+        if( vlc )
+        {
+            var mediaLen = vlc.input.length;
+            inputTrackerIgnoreChange = true;
+            if( mediaLen > 0 )
+            {
+                // seekable media
+                if( inputTracker )
+                {
+                    if( inputTracker.maxVal == 1.0 )
+                    {
+                        inputTracker.setDisabled(false);
+                        inputTracker.maxVal = 1.0;
+                    }
+                    inputTracker.setValue(vlc.input.position);
+                }
+                info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(mediaLen);
+            }
+            else
+            {
+                // non-seekable "live" media
+                if( inputTracker )
+                {
+                    if( inputTracker.maxVal != 0.0 )
+                    {
+                        inputTracker.maxVal = 0.0;
+                        inputTracker.setValue(0.0);
+                        inputTracker.setDisabled(true);
+                    }
+                }
+                liveFeedRoll = liveFeedRoll & 3;
+                info.innerHTML = liveFeedText[liveFeedRoll++];
+            }
+            inputTrackerIgnoreChange  = false;
+        }
+    }
+}
+
+function onPause()
+{
+    document.getElementById("state").innerHTML = "Paused...";
+    document.getElementById("PlayOrPause").value = " Play ";
+}
+
+function onStop()
+{
+    var vlc = getVLC("vlc");
+
+    if( inputTracker )
+    {
+        if( !inputTracker.disabled )
+        {
+            inputTracker.setValue(inputTracker.minVal);
+            inputTracker.setDisabled(true);
+        }
+    }
+
+    document.getElementById("info").innerHTML = "-:--:--/-:--:--";
+    document.getElementById("state").innerHTML = "Stopped...";
+    document.getElementById("PlayOrPause").value = " Play ";
+}
+
+function onError()
+{
+    var vlc = getVLC("vlc");
+
+    document.getElementById("state").innerHTML = "Error...";
+}
+
+function onInputTrackerScrollStart()
+{
+    inputTrackerScrolling = true;
+}
+
+function onInputTrackerScrollEnd(inputTracker, value, pos)
+{
+    inputTrackerScrolling = false;
+}
+
+function onInputTrackerChange(inputTracker, value, pos)
+{
+    if( !inputTrackerIgnoreChange )
+    {
+        var vlc = getVLC("vlc");
+        if( vlc )
+        {
+            if( (vlc.input.state == 3) && (vlc.input.position != value) )
+            {
+                var info = document.getElementById("info");
+                vlc.input.position = value;
+                info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length);
+            }
+        }
+    }
+}
+
+//-->
+</SCRIPT>
+</BODY>
+</HTML>
index 2c614202705481792078ae25028c3d0686ddff6a..0980d29497d0f094ce357d357ddda9546ba57aec 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
-<HTML>\r
-<TITLE>VLC Plugin test page</TITLE>\r
-<STYLE>\r
-  .inputTrackerInput {\r
-        height:20;\r
-        width:30;\r
-        font-family : Arial, Helvetica, sans-serif;\r
-        font-size : 12px;\r
-  }\r
-</STYLE>\r
-\r
-<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/lib/LibCrossBrowser.js"></SCRIPT>\r
-<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/lib/EventHandler.js"></SCRIPT>\r
-<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/core/form/Bs_FormUtil.lib.js"></SCRIPT>\r
-<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/components/slider/Bs_Slider.class.js"></SCRIPT>\r
-\r
-<SCRIPT language="JavaScript"><!--\r
-function init()\r
-{\r
-    inputTracker = new Bs_Slider();\r
-    if (inputTracker)\r
-    {\r
-        inputTracker.attachOnChange(onInputTrackerChange);\r
-        inputTracker.attachOnSlideStart(onInputTrackerScrollStart);\r
-        inputTracker.attachOnSlideEnd(onInputTrackerScrollEnd);\r
-        inputTracker.width         = 530 ;\r
-        inputTracker.height        = 15;\r
-        inputTracker.minVal        = 0;\r
-        inputTracker.maxVal        = 1.0;\r
-        inputTracker.valueDefault  = 0;\r
-        inputTracker.valueInterval = 1/530;\r
-        inputTracker.setDisabled(true);\r
-        inputTracker.imgDir   = 'blueshoes-4.5/javascript/components/slider/img/';\r
-        inputTracker.setBackgroundImage('aluminumalloyvolcanic/horizontal_background.gif', 'repeat');\r
-        inputTracker.setArrowIconLeft('aluminumalloyvolcanic/horizontal_backgroundLeft.gif', 2, 19);\r
-        inputTracker.setArrowIconRight('aluminumalloyvolcanic/horizontal_backgroundRight.gif', 2, 19);\r
-        inputTracker.setSliderIcon('aluminumalloyvolcanic/horizontal_knob.gif', 15, 19);\r
-        inputTracker.useInputField = 0;\r
-        inputTracker.draw('inputTrackerDiv');\r
-    }\r
-\r
-    if( navigator.appName.indexOf("Microsoft Internet")==-1 )\r
-    {\r
-        onVLCPluginReady()\r
-    }\r
-    else if( document.readyState == 'complete' )\r
-    {\r
-        onVLCPluginReady();\r
-    }\r
-    else\r
-    {\r
-        /* Explorer loads plugins asynchronously */\r
-        document.onreadystatechange=function()\r
-        {\r
-            if( document.readyState == 'complete' )\r
-            {\r
-                onVLCPluginReady();\r
-            }\r
-        }\r
-    }\r
-}\r
-\r
-function getVLC(name)\r
-{\r
-    if (window.document[name])\r
-    {\r
-        return window.document[name];\r
-    }\r
-    if (navigator.appName.indexOf("Microsoft Internet")==-1)\r
-    {\r
-        if (document.embeds && document.embeds[name])\r
-            return document.embeds[name];\r
-    }\r
-    else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)\r
-    {\r
-        return document.getElementById(name);\r
-    }\r
-}\r
-\r
-function onVLCPluginReady()\r
-{\r
-    updateVolume(0);\r
-}\r
-\r
-//--></SCRIPT>\r
-\r
-<BODY onLoad="init();">\r
-<TABLE>\r
-<TR><TD colspan="2">\r
-MRL:\r
-<INPUT size="90" id="targetTextField" value="">\r
-<INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">\r
-<INPUT type=submit value="Add" onClick="doAdd(document.getElementById('targetTextField').value);">\r
-</TD></TR>\r
-<TR><TD align="center" colspan="2">\r
-<!--\r
-Insert VideoLAN.VLCPlugin.2\r
--->\r
-<OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"\r
-        width="640"\r
-        height="480"\r
-        id="vlc"\r
-        events="True">\r
-<param name="MRL" value="" />\r
-<param name="ShowDisplay" value="True" />\r
-<param name="AutoLoop" value="False" />\r
-<param name="AutoPlay" value="False" />\r
-<param name="Volume" value="50" />\r
-<param name="toolbar" value="true" />\r
-<param name="StartTime" value="0" />\r
-<EMBED pluginspage="http://www.videolan.org"\r
-       type="application/x-vlc-plugin"\r
-       version="VideoLAN.VLCPlugin.2"\r
-       width="640"\r
-       height="480"\r
-       toolbar="true"\r
-       text="Waiting for video"\r
-       name="vlc">\r
-</EMBED>\r
-</OBJECT>\r
-</TD></TR>\r
-<TR><TD colspan="2">\r
-<TABLE><TR>\r
-<TD valign="top" width="550">\r
-<!--\r
-Insert Slider widget\r
--->\r
-<DIV id="inputTrackerDiv"</DIV>\r
-</TD><TD width="15%">\r
-<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>\r
-<DIV id="state" style="text-align:center">Stopped...</DIV>\r
-</TD></TR></TABLE>\r
-</TD></TR>\r
-<TR><TD>\r
-<INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause();'>\r
-<INPUT type=button value="Stop" onClick='doStop();'>\r
-&nbsp;\r
-<INPUT type=button value=" << " onClick='doPlaySlower();'>\r
-<INPUT type=button value="Reverse" onClick='doReverse();'>\r
-<INPUT type=button value=" >> " onClick='doPlayFaster();'>\r
-&nbsp;\r
-<INPUT type=button value="Fullscreen" onClick='getVLC("vlc").video.toggleFullscreen();'>\r
-<INPUT type=button value="Version" onClick='alert("vlc " + getVLC("vlc").VersionInfo);'>\r
-<INPUT type=button value=" State " onClick='alert("state: " + getVLC("vlc").input.state);'>\r
-</TD><TD align="right">\r
-<SPAN style="text-align:center">Volume:</SPAN>\r
-<INPUT type=button value=" - " onClick='updateVolume(-10)'>\r
-<SPAN id="volumeTextField" style="text-align:center">--</SPAN>\r
-<INPUT type=button value=" + " onClick='updateVolume(+10)'>\r
-<INPUT type=button value="Mute" onClick='getVLC("vlc").audio.toggleMute();'>\r
-</TD>\r
-</TR>\r
-<TR><TD>Playlist:\r
-<INPUT type=button value="Prev" onClick='getVLC("vlc").playlist.prev();'>\r
-<INPUT type=button value="Next" onClick='getVLC("vlc").playlist.next();'>\r
-<INPUT type=button value="Clear All" onClick='doPlaylistClearAll();'>\r
-    Aspect Ratio:\r
-    <SELECT readonly onChange='doAspectRatio(this.value)'>\r
-      <OPTION value="default">Default</OPTION>\r
-      <OPTION value="1:1">1:1</OPTION>\r
-      <OPTION value="4:3">4:3</OPTION>\r
-      <OPTION value="16:9">16:9</OPTION>\r
-      <OPTION value="221:100">221:100</OPTION>\r
-      <OPTION value="5:4">5:4</OPTION>\r
-    </SELECT>\r
-</TD><TD align="right">\r
-<INPUT type=button id="itemCount" value=" Items 0 " onClick='doItemCount();'>\r
-<INPUT size=4 value="" id="removeid"><INPUT type=submit value="Delete" onClick="doRemoveItem(document.getElementById('removeid').value);">\r
-</TD>\r
-</TR>\r
-<TR><TD>Audio Channel:\r
-  <SELECT readonly onClick='doAudioChannel(this.value);'>\r
-    <OPTION value=1>Stereo</OPTION>\r
-    <OPTION value=2>Reverse Stereo</OPTION>\r
-    <OPTION value=3>Left</OPTION>\r
-    <OPTION value=4>Right</OPTION>\r
-    <OPTION value=5>Dolby</OPTION>\r
-  </SELECT>\r
-</TD>\r
-<TD>\r
-<INPUT type=button value="current channel" onClick='alert(getVLC("vlc").audio.channel);'>\r
-</TD>\r
-</TR>\r
-<TR><TD> Audio Track:\r
-<INPUT type=button value=" + " onClick='doAudioTrack(1);'>\r
-<SPAN id="trackTextField" style="text-align:center">--</SPAN>\r
-<INPUT type=button value=" - " onClick='doAudioTrack(-1);'>\r
-<INPUT type=button value="current track" onClick='alert(getVLC("vlc").audio.description(vlc.audio.track));'>\r
-<INPUT type=button value="number of track" onClick='alert(getVLC("vlc").audio.count);'>\r
-</TD>\r
-<TD>\r
-<INPUT type=button value="set slider" onClick='doSetSlider();'>\r
-<INPUT type=button value="get position" onClick='doGetPosition();'>\r
-</TD>\r
-</TR>\r
-<TR>\r
-<TD>Video Subtitle:\r
-    <INPUT type=button value=" + " onClick='doSubtitle(1);'>\r
-    <SPAN id="spuTextField" style="text-align:center">--</SPAN>\r
-    <INPUT type=button value=" - " onClick='doSubtitle(-1);'>\r
-    <INPUT type=button value="current subtitle" onClick='alert(getVLC("vlc").subtitle.description(vlc.subtitle.track));'>\r
-    <INPUT type=button value="number of subtitle" onClick='alert(getVLC("vlc").subtitle.count);'>\r
-</TD>\r
-</TR>\r
-<TR>\r
-<TD>Deinterlacing:\r
-    <INPUT type=button value="BLEND" onClick='getVLC("vlc").video.deinterlace.enable("blend");'>\r
-    <INPUT type=button value="  X  " onClick='getVLC("vlc").video.deinterlace.enable("x");'>\r
-    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.deinterlace.disable();'>\r
-</TD>\r
-</TR>\r
-<TR>\r
-<TD>Marquee video filter:\r
-    <INPUT type=button value="Enable" onClick='getVLC("vlc").video.marquee.enable();'>\r
-    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.marquee.disable();'>\r
-    <INPUT size=4 value="" id="marqueeIntValue">\r
-    <SELECT readonly onClick="doMarqueeOption(this.value,document.getElementById('marqueeIntValue').value);">\r
-        <OPTION value=1>Color</OPTION>\r
-        <OPTION value=2>Opacity</OPTION>\r
-        <OPTION value=3>Position</OPTION>\r
-        <OPTION value=4>Refresh</OPTION>\r
-        <OPTION value=5>Size</OPTION>\r
-        <OPTION value=6>Text</OPTION>\r
-        <OPTION value=7>Timeout</OPTION>\r
-        <OPTION value=8>X</OPTION>\r
-        <OPTION value=9>Y</OPTION>\r
-    </SELECT>\r
-</TD>\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<TITLE>VLC Plugin test page</TITLE>
+<STYLE>
+  .inputTrackerInput {
+        height:20;
+        width:30;
+        font-family : Arial, Helvetica, sans-serif;
+        font-size : 12px;
+  }
+</STYLE>
+
+<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/lib/LibCrossBrowser.js"></SCRIPT>
+<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/lib/EventHandler.js"></SCRIPT>
+<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/core/form/Bs_FormUtil.lib.js"></SCRIPT>
+<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/components/slider/Bs_Slider.class.js"></SCRIPT>
+
+<SCRIPT language="JavaScript"><!--
+function init()
+{
+    inputTracker = new Bs_Slider();
+    if (inputTracker)
+    {
+        inputTracker.attachOnChange(onInputTrackerChange);
+        inputTracker.attachOnSlideStart(onInputTrackerScrollStart);
+        inputTracker.attachOnSlideEnd(onInputTrackerScrollEnd);
+        inputTracker.width         = 530;
+        inputTracker.height        = 15;
+        inputTracker.minVal        = 0;
+        inputTracker.maxVal        = 1.0;
+        inputTracker.valueDefault  = 0;
+        inputTracker.valueInterval = 1/530;
+        inputTracker.setDisabled(true);
+        inputTracker.imgDir   = 'blueshoes-4.5/javascript/components/slider/img/';
+        inputTracker.setBackgroundImage('aluminumalloyvolcanic/horizontal_background.gif', 'repeat');
+        inputTracker.setArrowIconLeft('aluminumalloyvolcanic/horizontal_backgroundLeft.gif', 2, 19);
+        inputTracker.setArrowIconRight('aluminumalloyvolcanic/horizontal_backgroundRight.gif', 2, 19);
+        inputTracker.setSliderIcon('aluminumalloyvolcanic/horizontal_knob.gif', 15, 19);
+        inputTracker.useInputField = 0;
+        inputTracker.draw('inputTrackerDiv');
+    }
+
+    if( navigator.appName.indexOf("Microsoft Internet")==-1 )
+    {
+        onVLCPluginReady()
+    }
+    else if( document.readyState == 'complete' )
+    {
+        onVLCPluginReady();
+    }
+    else
+    {
+        /* Explorer loads plugins asynchronously */
+        document.onreadystatechange=function()
+        {
+            if( document.readyState == 'complete' )
+            {
+                onVLCPluginReady();
+            }
+        }
+    }
+}
+
+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);
+    }
+}
+
+function registerVLCEvent(event, handler)
+{
+    var vlc = getVLC("vlc");
+
+    if (vlc) {
+        if (vlc.attachEvent) {
+            // Microsoft
+            vlc.attachEvent (event, handler);
+        } else if (vlc.addEventListener) {
+            // Mozilla: DOM level 2
+            vlc.addEventListener (event, handler, true);
+        } else {
+            // DOM level 0
+            eval("vlc.on" + event + " = handler");
+        }
+    }
+}
+
+function unregisterVLCEvent(event, handler)
+{
+    var vlc = getVLC("vlc");
+
+    if (vlc) {
+        if (vlc.detachEvent) {
+            // Microsoft
+            vlc.detachEvent (event, handler);
+        } else if (vlc.removeEventListener) {
+            // Mozilla: DOM level 2
+            vlc.removeEventListener (event, handler, true);
+        } else {
+            // DOM level 0
+            eval("vlc.on" + event + " = null");
+        }
+    }
+}
+
+// JS VLC API callbacks
+function handleMediaPlayerMediaChanged()
+{
+    document.getElementById("info").innerHTML = "Media Changed";
+}
+
+function handle_MediaPlayerNothingSpecial()
+{
+    document.getElementById("state").innerHTML = "Idle...";
+}
+
+function handle_MediaPlayerOpening()
+{
+    onOpen();
+}
+
+function handle_MediaPlayerBuffering(val)
+{
+    document.getElementById("info").innerHTML = val + "%";
+}
+
+function handle_MediaPlayerPlaying()
+{
+    onPlay();
+}
+
+function handle_MediaPlayerPaused()
+{
+    onPause();
+}
+
+function handle_MediaPlayerStopped()
+{
+    onStop();
+}
+
+function handle_MediaPlayerForward()
+{
+    document.getElementById("state").innerHTML = "Forward...";
+}
+
+function handle_MediaPlayerBackward()
+{
+    document.getElementById("state").innerHTML = "Backward...";
+}
+
+function handle_MediaPlayerEndReached()
+{
+    onEnd();
+}
+
+function handle_MediaPlayerEncounteredError()
+{
+    onError();
+}
+
+function handle_MediaPlayerTimeChanged(time)
+{
+    var vlc = getVLC("vlc");
+    var info = document.getElementById("info");
+    if( vlc )
+    {
+        var mediaLen = vlc.input.length;
+        if( mediaLen > 0 )
+        {
+            // seekable media
+            info.innerHTML = formatTime(time)+"/"+formatTime(mediaLen);
+        }
+    }
+}
+
+function handle_MediaPlayerPositionChanged(val)
+{
+    // set javascript slider to correct position
+}
+
+function handle_MediaPlayerSeekableChanged(val)
+{
+    setSeekable(val);
+}
+
+function handle_MediaPlayerPausableChanged(val)
+{
+    setPauseable(val);
+}
+
+function handle_MediaPlayerTitleChanged(val)
+{
+    //setTitle(val);
+    document.getElementById("info").innerHTML = "Title: " + val;
+}
+
+function handle_MediaPlayerLengthChanged(val)
+{
+    //setMediaLength(val);
+}
+
+// VLC Plugin
+function onVLCPluginReady()
+{
+    registerVLCEvent("MediaPlayerMediaChanged", handleMediaPlayerMediaChanged);
+    registerVLCEvent("MediaPlayerNothingSpecial", handle_MediaPlayerNothingSpecial);
+    registerVLCEvent("MediaPlayerOpening", handle_MediaPlayerOpening);
+    registerVLCEvent("MediaPlayerBuffering", handle_MediaPlayerBuffering);
+    registerVLCEvent("MediaPlayerPlaying", handle_MediaPlayerPlaying);
+    registerVLCEvent("MediaPlayerPaused", handle_MediaPlayerPaused);
+    registerVLCEvent("MediaPlayerStopped", handle_MediaPlayerStopped);
+    registerVLCEvent("MediaPlayerForward", handle_MediaPlayerForward);
+    registerVLCEvent("MediaPlayerBackward", handle_MediaPlayerBackward);
+    registerVLCEvent("MediaPlayerEndReached", handle_MediaPlayerEndReached);
+    registerVLCEvent("MediaPlayerEncounteredError", handle_MediaPlayerEncounteredError);
+    registerVLCEvent("MediaPlayerTimeChanged", handle_MediaPlayerTimeChanged);
+    registerVLCEvent("MediaPlayerPositionChanged", handle_MediaPlayerPositionChanged);
+    registerVLCEvent("MediaPlayerSeekableChanged", handle_MediaPlayerSeekableChanged);
+    registerVLCEvent("MediaPlayerPausableChanged", handle_MediaPlayerPausableChanged);
+    registerVLCEvent("MediaPlayerTitleChanged", handle_MediaPlayerTitleChanged);
+    registerVLCEvent("MediaPlayerLengthChanged", handle_MediaPlayerLengthChanged);
+}
+
+function close()
+{
+    unregisterVLCEvent('MediaPlayerMouseGrab', handleMouseGrab);
+    unregisterVLCEvent('MediaPlayerMouseRelease', handleMouseRelease);
+    unregisterVLCEvent('MediaPlayerMouseClick', handleMouseClick);
+
+    unregisterVLCEvent("MediaPlayerMediaChanged", handleMediaPlayerMediaChanged);
+    unregisterVLCEvent("MediaPlayerNothingSpecial", handle_MediaPlayerNothingSpecial);
+    unregisterVLCEvent("MediaPlayerOpening", handle_MediaPlayerOpening);
+    unregisterVLCEvent("MediaPlayerBuffering", handle_MediaPlayerBuffering);
+    unregisterVLCEvent("MediaPlayerPlaying", handle_MediaPlayerPlaying);
+    unregisterVLCEvent("MediaPlayerPaused", handle_MediaPlayerPaused);
+    unregisterVLCEvent("MediaPlayerStopped", handle_MediaPlayerStopped);
+    unregisterVLCEvent("MediaPlayerForward", handle_MediaPlayerForward);
+    unregisterVLCEvent("MediaPlayerBackward", handle_MediaPlayerBackward);
+    unregisterVLCEvent("MediaPlayerEndReached", handle_MediaPlayerEndReached);
+    unregisterVLCEvent("MediaPlayerEncounteredError", handle_MediaPlayerEncounteredError);
+    unregisterVLCEvent("MediaPlayerTimeChanged", handle_MediaPlayerTimeChanged);
+    unregisterVLCEvent("MediaPlayerPositionChanged", handle_MediaPlayerPositionChanged);
+    unregisterVLCEvent("MediaPlayerSeekableChanged", handle_MediaPlayerSeekableChanged);
+    unregisterVLCEvent("MediaPlayerPausableChanged", handle_MediaPlayerPausableChanged);
+    unregisterVLCEvent("MediaPlayerTitleChanged", handle_MediaPlayerTitleChanged);
+    unregisterVLCEvent("MediaPlayerLengthChanged", handle_MediaPlayerLengthChanged);
+}
+
+//--></SCRIPT>
+
+<BODY onLoad="init();" onClose="close();">
+<TABLE>
+<TR><TD colspan="2">
+MRL:
+<INPUT size="90" id="targetTextField" value="">
+<INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">
+<INPUT type=submit value="Add" onClick="doAdd(document.getElementById('targetTextField').value);">
+</TD></TR>
+<TR><TD align="center" colspan="2">
+<!--
+Insert VideoLAN.VLCPlugin.2
+-->
+<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="toolbar" value="true" />
+<param name="StartTime" value="0" />
+<EMBED pluginspage="http://www.videolan.org"
+       type="application/x-vlc-plugin"
+       version="VideoLAN.VLCPlugin.2"
+       width="640"
+       height="480"
+       toolbar="true"
+       text="Waiting for video"
+       name="vlc">
+</EMBED>
+</OBJECT>
+</TD></TR>
+<TR><TD colspan="2">
+<TABLE><TR>
+<TD valign="top" width="550">
+<!--
+Insert Slider widget
+-->
+<DIV id="inputTrackerDiv"</DIV>
+</TD><TD width="15%">
+<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
+<DIV id="state" style="text-align:center">Stopped...</DIV>
+</TD></TR></TABLE>
+</TD></TR>
+<TR><TD>
+<INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause();'>
+<INPUT type=button value="Stop" onClick='doStop();'>
+&nbsp;
+<INPUT type=button value=" << " onClick='doPlaySlower();'>
+<INPUT type=button value="Reverse" onClick='doReverse();'>
+<INPUT type=button value=" >> " onClick='doPlayFaster();'>
+&nbsp;
+<INPUT type=button value="Fullscreen" onClick='getVLC("vlc").video.toggleFullscreen();'>
+<INPUT type=button value="Version" onClick='alert("vlc " + getVLC("vlc").VersionInfo);'>
+<INPUT type=button value=" State " onClick='alert("state: " + getVLC("vlc").input.state);'>
+</TD><TD align="right">
+<SPAN style="text-align:center">Volume:</SPAN>
+<INPUT type=button value=" - " onClick='updateVolume(-10)'>
+<SPAN id="volumeTextField" style="text-align:center">--</SPAN>
+<INPUT type=button value=" + " onClick='updateVolume(+10)'>
+<INPUT type=button value="Mute" onClick='getVLC("vlc").audio.toggleMute();'>
+</TD>
+</TR>
+<TR><TD>Playlist:
+<INPUT type=button value="Prev" onClick='getVLC("vlc").playlist.prev();'>
+<INPUT type=button value="Next" onClick='getVLC("vlc").playlist.next();'>
+<INPUT type=button value="Clear All" onClick='doPlaylistClearAll();'>
+    Aspect Ratio:
+    <SELECT readonly onChange='doAspectRatio(this.value)'>
+      <OPTION value="default">Default</OPTION>
+      <OPTION value="1:1">1:1</OPTION>
+      <OPTION value="4:3">4:3</OPTION>
+      <OPTION value="16:9">16:9</OPTION>
+      <OPTION value="221:100">221:100</OPTION>
+      <OPTION value="5:4">5:4</OPTION>
+    </SELECT>
+</TD><TD align="right">
+<INPUT type=button id="itemCount" value=" Items 0 " onClick='doItemCount();'>
+<INPUT size=4 value="" id="removeid"><INPUT type=submit value="Delete" onClick="doRemoveItem(document.getElementById('removeid').value);">
+</TD>
+</TR>
+<TR><TD>Audio Channel:
+  <SELECT readonly onClick='doAudioChannel(this.value);'>
+    <OPTION value=1>Stereo</OPTION>
+    <OPTION value=2>Reverse Stereo</OPTION>
+    <OPTION value=3>Left</OPTION>
+    <OPTION value=4>Right</OPTION>
+    <OPTION value=5>Dolby</OPTION>
+  </SELECT>
+</TD>
+<TD>
+<INPUT type=button value="current channel" onClick='alert(getVLC("vlc").audio.channel);'>
+</TD>
+</TR>
+<TR><TD> Audio Track:
+<INPUT type=button value=" + " onClick='doAudioTrack(1);'>
+<SPAN id="trackTextField" style="text-align:center">--</SPAN>
+<INPUT type=button value=" - " onClick='doAudioTrack(-1);'>
+<INPUT type=button value="current track" onClick='alert(getVLC("vlc").audio.description(vlc.audio.track));'>
+<INPUT type=button value="number of track" onClick='alert(getVLC("vlc").audio.count);'>
+</TD>
+<TD>
+<INPUT type=button value="set slider" onClick='doSetSlider();'>
+<INPUT type=button value="get position" onClick='doGetPosition();'>
+</TD>
+</TR>
+<TR>
+<TD>Video Subtitle:
+    <INPUT type=button value=" + " onClick='doSubtitle(1);'>
+    <SPAN id="spuTextField" style="text-align:center">--</SPAN>
+    <INPUT type=button value=" - " onClick='doSubtitle(-1);'>
+    <INPUT type=button value="current subtitle" onClick='alert(getVLC("vlc").subtitle.description(vlc.subtitle.track));'>
+    <INPUT type=button value="number of subtitle" onClick='alert(getVLC("vlc").subtitle.count);'>
+</TD>
+</TR>
+<TR>
+<TD>Deinterlacing:
+    <INPUT type=button value="BLEND" onClick='getVLC("vlc").video.deinterlace.enable("blend");'>
+    <INPUT type=button value="  X  " onClick='getVLC("vlc").video.deinterlace.enable("x");'>
+    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.deinterlace.disable();'>
+</TD>
+</TR>
+<TR>
+<TD>Marquee video filter:
+    <INPUT type=button value="Enable" onClick='getVLC("vlc").video.marquee.enable();'>
+    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.marquee.disable();'>
+    <INPUT size=4 value="" id="marqueeIntValue">
+    <SELECT readonly onClick="doMarqueeOption(this.value,document.getElementById('marqueeIntValue').value);">
+        <OPTION value=1>Color</OPTION>
+        <OPTION value=2>Opacity</OPTION>
+        <OPTION value=3>Position</OPTION>
+        <OPTION value=4>Refresh</OPTION>
+        <OPTION value=5>Size</OPTION>
+        <OPTION value=6>Text</OPTION>
+        <OPTION value=7>Timeout</OPTION>
+        <OPTION value=8>X</OPTION>
+        <OPTION value=9>Y</OPTION>
+    </SELECT>
+</TD>
 </TR>
-<TR>\r
-<TD>Logo video filter:\r
-    <INPUT type=button value="Enable" onClick='getVLC("vlc").video.logo.enable();'>\r
-    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.logo.disable();'>\r
-    <INPUT size=4 value="" id="logoIntValue">\r
-    <SELECT readonly onClick="doLogoOption(this.value,document.getElementById('logoIntValue').value);">\r
-        <OPTION value=1>File</OPTION>\r
-        <OPTION value=2>Position</OPTION>\r
-        <OPTION value=3>Opacity</OPTION>\r
-        <OPTION value=4>Repeat</OPTION>\r
-        <OPTION value=5>Delay</OPTION>\r
-        <OPTION value=6>X</OPTION>\r
+<TR>
+<TD>Logo video filter:
+    <INPUT type=button value="Enable" onClick='getVLC("vlc").video.logo.enable();'>
+    <INPUT type=button value="Disable" onClick='getVLC("vlc").video.logo.disable();'>
+    <INPUT size=4 value="" id="logoIntValue">
+    <SELECT readonly onClick="doLogoOption(this.value,document.getElementById('logoIntValue').value);">
+        <OPTION value=1>File</OPTION>
+        <OPTION value=2>Position</OPTION>
+        <OPTION value=3>Opacity</OPTION>
+        <OPTION value=4>Repeat</OPTION>
+        <OPTION value=5>Delay</OPTION>
+        <OPTION value=6>X</OPTION>
         <OPTION value=7>Y</OPTION>
-    </SELECT>\r
-</TD>\r
-</TR>\r\r
-<TR>\r
-<TD>\r
-    <INPUT type=button id="telx" value="Teletext off" onClick='doToggleTeletext();'>\r
-    Teletext page:\r
-    <INPUT size=4 value="100" id="telxPage" onClick='doTelxPage(document.getElementById("telxPage").value);'>\r
-</TD>\r
-</TR>\r
-</TABLE>\r
-<SCRIPT language="javascript">\r
-<!--\r
-\r
-var rate = 0;\r
-var prevState = 0;\r
-var monitorTimerId = 0;\r
-var inputTracker;\r
-var inputTrackerScrolling = false;\r
-var inputTrackerIgnoreChange = false;\r
-var telxState = false;\r
-\r
-function doSetSlider()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    // set slider to new position\r
-    if( vlc )\r
-        vlc.input.time = (vlc.input.length/2);\r
-}\r
-\r
-function doGetPosition()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    // set slider to new position\r
-    if (vlc)\r
-        alert( "position is " + vlc.input.time);\r
-}\r
-\r
-function doReverse(rate)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.input.rate = -1.0 * vlc.input.rate;\r
-}\r
-\r
-function doAudioChannel(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.audio.channel = parseInt(value);\r
-}\r
-\r
-function doAudioTrack(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        vlc.audio.track = vlc.audio.track + value;\r
-        document.getElementById("trackTextField").innerHTML = vlc.audio.track;\r
-    }\r
-}\r
-\r
-function doAspectRatio(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.video.aspectRatio = value;\r
-}\r
-\r
-function doSubtitle(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        vlc.subtitle.track = vlc.subtitle.track + value;\r
-        document.getElementById("spuTextField").innerHTML = vlc.subtitle.track;\r
-    }\r
-}\r
-\r
-function doTelxPage(value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.video.teletext = parseInt(value);\r
-}\r
-\r
-function doToggleTeletext()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    if( vlc )\r
-    {\r
-        vlc.video.toggleTeletext();\r
-        if (telxState)\r
-        {\r
-            document.getElementById("telx").innerHTML = "Teletext on";\r
-            telxState = true;\r
-        }\r
-        else\r
-        {\r
-            document.getElementById("telx").innerHTML = "Teletext off";\r
-            telxState = false;\r
-        }\r
-    }\r
-}\r
-\r
-function doItemCount()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        var count = vlc.playlist.items.count;\r
-        document.getElementById("itemCount").value = " Items " + count + " ";\r
-    }\r
-}\r
-\r
-function doRemoveItem(item)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.playlist.items.remove(item);\r
-}\r
-\r
-function doPlaylistClearAll()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        vlc.playlist.items.clear();\r
-        while( vlc.playlist.items.count > 0)\r
-        {\r
-            // wait till playlist empties.\r
-        }\r
-        doItemCount();\r
-    }\r
-}\r
-\r
-function updateVolume(deltaVol)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        vlc.audio.volume += deltaVol;\r
-        document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";\r
-    }\r
-}\r
-\r
-function formatTime(timeVal)\r
-{\r
-    if( typeof timeVal != 'number' )\r
-        return "-:--:--";\r
-\r
-    var timeHour = Math.round(timeVal / 1000);\r
-    var timeSec = timeHour % 60;\r
-    if( timeSec < 10 )\r
-        timeSec = '0'+timeSec;\r
-    timeHour = (timeHour - timeSec)/60;\r
-    var timeMin = timeHour % 60;\r
-    if( timeMin < 10 )\r
-        timeMin = '0'+timeMin;\r
-    timeHour = (timeHour - timeMin)/60;\r
-    if( timeHour > 0 )\r
-        return timeHour+":"+timeMin+":"+timeSec;\r
-    else\r
-        return timeMin+":"+timeSec;\r
-}\r
-\r
-function doState()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    var newState = 0;\r
-\r
-    if( vlc )\r
-        newState = vlc.input.state;\r
-\r
-    if( newState == 0 )\r
-    {\r
-        // current media has stopped\r
-        onEnd();\r
-    }\r
-    else if( newState == 1 )\r
-    {\r
-        // current media is openning/connecting\r
-        onOpen();\r
-    }\r
-    else if( newState == 2 )\r
-    {\r
-        // current media is buffering data\r
-        onBuffer();\r
-    }\r
-    else if( newState == 3 )\r
-    {\r
-        // current media is now playing\r
-        onPlay();\r
-    }\r
-    else if( newState == 4 )\r
-    {\r
-        // current media is now paused\r
-        onPause();\r
-    }\r
-    else if( newState == 5 )\r
-    {\r
-        // current media has stopped\r
-        onStop();\r
-    }\r
-    else if( newState == 6 )\r
-    {\r
-        // current media has ended\r
-        onEnd();\r
-    }\r
-    else if( newState == 7 )\r
-    {\r
-        // current media encountered error\r
-        onError();\r
-    }\r
-}\r
-\r
-function monitor()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    var newState = 0;\r
-\r
-    if( vlc )\r
-    {\r
-        newState = vlc.input.state;\r
-    }\r
-\r
-    if( prevState != newState )\r
-    {\r
-        if( newState == 0 )\r
-        {\r
-            // current media has stopped\r
-            onEnd();\r
-        }\r
-        else if( newState == 1 )\r
-        {\r
-            // current media is openning/connecting\r
-            onOpen();\r
-        }\r
-        else if( newState == 2 )\r
-        {\r
-            // current media is buffering data\r
-            onBuffer();\r
-        }\r
-        else if( newState == 3 )\r
-        {\r
-            // current media is now playing\r
-            onPlay();\r
-        }\r
-        else if( newState == 4 )\r
-        {\r
-            // current media is now paused\r
-            onPause();\r
-        }\r
-        else if( newState == 5 )\r
-        {\r
-            // current media has stopped\r
-                onStop();\r
-        }\r
-        else if( newState == 6 )\r
-        {\r
-            // current media has ended\r
-            onEnd();\r
-        }\r
-        else if( newState == 7 )\r
-        {\r
-            // current media encountered error\r
-            onError();\r
-        }\r
-        prevState = newState;\r
-    }\r
-    else if( newState == 3 )\r
-    {\r
-        // current media is playing\r
-        onPlaying();\r
-    }\r
-    if( monitorTimerId == 0 )\r
-    {\r
-        monitorTimerId = setInterval("monitor()", 1000);\r
-    }\r
-};\r
-\r
-/* actions */\r
-\r
-function doGo(targetURL)\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    if( vlc )\r
-    {\r
-        vlc.playlist.items.clear();\r
-        while( vlc.playlist.items.count > 0 )\r
-        {\r
-            // clear() may return before the playlist has actually been cleared\r
-            // just wait for it to finish its job\r
-        }\r
-        var options = [":rtsp-tcp"];\r
-        var itemId = vlc.playlist.add(targetURL,"",options);\r
-        options = [];\r
-        if( itemId != -1 )\r
-        {\r
-            // play MRL\r
-            vlc.playlist.playItem(itemId);\r
-            if( monitorTimerId == 0 )\r
-            {\r
-                monitor();\r
-            }\r
-        }\r
-        else\r
-        {\r
-            alert("cannot play at the moment !");\r
-        }\r
-        doItemCount();\r
-    }\r
-}\r
-\r
-function doAdd(targetURL)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    var options = [":vout-filter=deinterlace", ":deinterlace-mode=linear"];\r
-    if( vlc )\r
-    {\r
-        vlc.playlist.add(targetURL, "", options);\r
-        options = [];\r
-        doItemCount();\r
-    }\r
-}\r
-\r
-function doPlayOrPause()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        if( vlc.playlist.isPlaying )\r
-        {\r
-            vlc.playlist.togglePause();\r
-            monitor();\r
-        }\r
-        else if( vlc.playlist.items.count > 0 )\r
-        {\r
-            vlc.playlist.play();\r
-            monitor();\r
-        }\r
-        else\r
-        {\r
-            alert('nothing to play !');\r
-        }\r
-    }\r
-}\r
-\r
-function doStop()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    if( vlc )\r
-        vlc.playlist.stop();\r
-\r
-    if( monitorTimerId != 0 )\r
-    {\r
-        clearInterval(monitorTimerId);\r
-        monitorTimerId = 0;\r
-    }\r
-    onStop();\r
-}\r
-\r
-function doPlaySlower()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.input.rate = vlc.input.rate / 2;\r
-}\r
-\r
-function doPlayFaster()\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-        vlc.input.rate = vlc.input.rate * 2;\r
-}\r
-\r
-/* events */\r
-\r
-function onOpen()\r
-{\r
-    document.getElementById("state").innerHTML = "Opening...";\r
-    document.getElementById("PlayOrPause").value = "Pause";\r
-}\r
-\r
-function onBuffer()\r
-{\r
-    document.getElementById("state").innerHTML = "Buffering...";\r
-    document.getElementById("PlayOrPause").value = "Pause";\r
-}\r
-\r
-function onPlay()\r
-{\r
-    document.getElementById("state").innerHTML = "Playing...";\r
-    document.getElementById("PlayOrPause").value = "Pause";\r
-    onPlaying();\r
-}\r
-\r
-function onEnd()\r
-{\r
-    document.getElementById("state").innerHTML = "End...";\r
-    doStop();\r
-}\r
-\r
-var liveFeedText = ["Live", "((Live))", "(( Live ))", "((  Live  ))"];\r
-var liveFeedRoll = 0;\r
-\r
-function onPlaying()\r
-{\r
-    if( !inputTrackerScrolling )\r
-    {\r
-        var vlc = getVLC("vlc");\r
-        var info = document.getElementById("info");\r
-        if( vlc )\r
-        {\r
-            var mediaLen = vlc.input.length;\r
-            inputTrackerIgnoreChange = true;\r
-            if( mediaLen > 0 )\r
-            {\r
-                // seekable media\r
-                if( inputTracker )\r
-                {\r
-                    if( inputTracker.maxVal == 1.0 )\r
-                    {\r
-                        inputTracker.setDisabled(false);\r
-                        inputTracker.maxVal = 1.0;\r
-                    }\r
-                    inputTracker.setValue(vlc.input.position);\r
-                }\r
-                info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(mediaLen);\r
-            }\r
-            else\r
-            {\r
-                // non-seekable "live" media\r
-                if( inputTracker )\r
-                {\r
-                    if( inputTracker.maxVal != 0.0 )\r
-                    {\r
-                        inputTracker.maxVal = 0.0;\r
-                        inputTracker.setValue(0.0);\r
-                        inputTracker.setDisabled(true);\r
-                    }\r
-                }\r
-                liveFeedRoll = liveFeedRoll & 3;\r
-                info.innerHTML = liveFeedText[liveFeedRoll++];\r
-            }\r
-            inputTrackerIgnoreChange  = false;\r
-        }\r
-    }\r
-}\r
-\r
-function onPause()\r
-{\r
-    document.getElementById("state").innerHTML = "Paused...";\r
-    document.getElementById("PlayOrPause").value = " Play ";\r
-}\r
-\r
-function onStop()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    if( inputTracker )\r
-    {\r
-        if( !inputTracker.disabled )\r
-        {\r
-            inputTracker.setValue(inputTracker.minVal);\r
-            inputTracker.setDisabled(true);\r
-        }\r
-    }\r
-\r
-    document.getElementById("info").innerHTML = "-:--:--/-:--:--";\r
-    document.getElementById("state").innerHTML = "Stopped...";\r
-    document.getElementById("PlayOrPause").value = " Play ";\r
-}\r
-\r
-function onError()\r
-{\r
-    var vlc = getVLC("vlc");\r
-\r
-    document.getElementById("state").innerHTML = "Error...";\r
-}\r
-\r
-function onInputTrackerScrollStart()\r
-{\r
-    inputTrackerScrolling = true;\r
-}\r
-\r
-function onInputTrackerScrollEnd(inputTracker, value, pos)\r
-{\r
-    inputTrackerScrolling = false;\r
-}\r
-\r
-function onInputTrackerChange(inputTracker, value, pos)\r
-{\r
-    if( !inputTrackerIgnoreChange )\r
-    {\r
-        var vlc = getVLC("vlc");\r
-        if( vlc )\r
-        {\r
-            if( (vlc.input.state == 3) && (vlc.input.position != value) )\r
-            {\r
-                var info = document.getElementById("info");\r
-                vlc.input.position = value;\r
-                info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length);\r
-            }\r
-        }\r
-    }\r
-}\r
-\r
-function doMarqueeOption(option, value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    val = parseInt(value);\r
-    if( vlc )\r
-    {\r
-        if (option == 1)\r
-            vlc.video.marquee.color = val;\r
-        if (option == 2)\r
-            vlc.video.marquee.opacity = val;\r
-        if (option == 3)\r
-            vlc.video.marquee.position = value;\r
-        if (option == 4)\r
-            vlc.video.marquee.refresh = val;\r
-        if (option == 5)\r
-            vlc.video.marquee.size = val;\r
-        if (option == 6)\r
-            vlc.video.marquee.text = value;\r
-        if (option == 7)\r
-            vlc.video.marquee.timeout = val;\r
-        if (option == 8)\r
-            vlc.video.marquee.x = val;\r
-        if (option == 9)\r
-            vlc.video.marquee.y = val;\r
-    }\r
-}\r
-
-function doLogoOption(option, value)\r
-{\r
-    var vlc = getVLC("vlc");\r
-    if( vlc )\r
-    {\r
-        if (option == 1)\r
-            vlc.video.logo.file(value);\r
-        if (option == 2)\r
-            vlc.video.logo.position = value;\r
-        val = parseInt(value);\r
-        if (option == 3)\r
-            vlc.video.logo.opacity = val;\r
-        if (option == 4)\r
-            vlc.video.logo.repeat = val;\r
-        if (option == 5)\r
-            vlc.video.logo.delay = val;\r
-        if (option == 6)\r
-            vlc.video.logo.x = val;\r
-        if (option == 7)\r
-            vlc.video.logo.y = val;\r
-    }\r
-}\r
-\r
-//-->\r
-</SCRIPT>\r
-</BODY>\r
-</HTML>\r
+    </SELECT>
+</TD>
+</TR>
+<TR>
+<TD>
+    <INPUT type=button id="telx" value="Teletext off" onClick='doToggleTeletext();'>
+    Teletext page:
+    <INPUT size=4 value="100" id="telxPage" onClick='doTelxPage(document.getElementById("telxPage").value);'>
+</TD>
+</TR>
+</TABLE>
+<SCRIPT language="javascript">
+<!--
+
+var rate = 0;
+var prevState = 0;
+var monitorTimerId = 0;
+var inputTracker;
+var inputTrackerScrolling = false;
+var inputTrackerIgnoreChange = false;
+var telxState = false;
+var canPause = true;
+var canSeek = true;
+
+function setPauseable(val)
+{
+    canPause = val;
+}
+
+function setSeekable(val)
+{
+    canSeek = val;
+}
+
+function doSetSlider()
+{
+    var vlc = getVLC("vlc");
+
+    // set slider to new position
+    if( vlc )
+        vlc.input.time = (vlc.input.length/2);
+}
+
+function doGetPosition()
+{
+    var vlc = getVLC("vlc");
+
+    // set slider to new position
+    if (vlc)
+        alert( "position is " + vlc.input.time);
+}
+
+function doReverse(rate)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.input.rate = -1.0 * vlc.input.rate;
+}
+
+function doAudioChannel(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.audio.channel = parseInt(value);
+}
+
+function doAudioTrack(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        vlc.audio.track = vlc.audio.track + value;
+        document.getElementById("trackTextField").innerHTML = vlc.audio.track;
+    }
+}
+
+function doAspectRatio(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.video.aspectRatio = value;
+}
+
+function doSubtitle(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        vlc.subtitle.track = vlc.subtitle.track + value;
+        document.getElementById("spuTextField").innerHTML = vlc.subtitle.track;
+    }
+}
+
+function doTelxPage(value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.video.teletext = parseInt(value);
+}
+
+function doToggleTeletext()
+{
+    var vlc = getVLC("vlc");
+
+    if( vlc )
+    {
+        vlc.video.toggleTeletext();
+        if (telxState)
+        {
+            document.getElementById("telx").innerHTML = "Teletext on";
+            telxState = true;
+        }
+        else
+        {
+            document.getElementById("telx").innerHTML = "Teletext off";
+            telxState = false;
+        }
+    }
+}
+
+function doItemCount()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        var count = vlc.playlist.items.count;
+        document.getElementById("itemCount").value = " Items " + count + " ";
+    }
+}
+
+function doRemoveItem(item)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.playlist.items.remove(item);
+}
+
+function doPlaylistClearAll()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        vlc.playlist.items.clear();
+        while( vlc.playlist.items.count > 0)
+        {
+            // wait till playlist empties.
+        }
+        doItemCount();
+    }
+}
+
+function updateVolume(deltaVol)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        vlc.audio.volume += deltaVol;
+        document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
+    }
+}
+
+function formatTime(timeVal)
+{
+    if( typeof timeVal != 'number' )
+        return "-:--:--";
+
+    var timeHour = Math.round(timeVal / 1000);
+    var timeSec = timeHour % 60;
+    if( timeSec < 10 )
+        timeSec = '0'+timeSec;
+    timeHour = (timeHour - timeSec)/60;
+    var timeMin = timeHour % 60;
+    if( timeMin < 10 )
+        timeMin = '0'+timeMin;
+    timeHour = (timeHour - timeMin)/60;
+    if( timeHour > 0 )
+        return timeHour+":"+timeMin+":"+timeSec;
+    else
+        return timeMin+":"+timeSec;
+}
+
+function doState()
+{
+    var vlc = getVLC("vlc");
+    var newState = 0;
+
+    if( vlc )
+        newState = vlc.input.state;
+
+    if( newState == 0 )
+    {
+        // current media has stopped
+        onEnd();
+    }
+    else if( newState == 1 )
+    {
+        // current media is openning/connecting
+        onOpen();
+    }
+    else if( newState == 2 )
+    {
+        // current media is buffering data
+        onBuffer();
+    }
+    else if( newState == 3 )
+    {
+        // current media is now playing
+        onPlay();
+    }
+    else if( newState == 4 )
+    {
+        // current media is now paused
+        onPause();
+    }
+    else if( newState == 5 )
+    {
+        // current media has stopped
+        onStop();
+    }
+    else if( newState == 6 )
+    {
+        // current media has ended
+        onEnd();
+    }
+    else if( newState == 7 )
+    {
+        // current media encountered error
+        onError();
+    }
+}
+
+function monitor()
+{
+    var vlc = getVLC("vlc");
+    var newState = 0;
+
+    if( vlc )
+    {
+        newState = vlc.input.state;
+    }
+
+    if( prevState != newState )
+    {
+        if( newState == 0 )
+        {
+            // current media has stopped
+            onEnd();
+        }
+        else if( newState == 1 )
+        {
+            // current media is openning/connecting
+            onOpen();
+        }
+        else if( newState == 2 )
+        {
+            // current media is buffering data
+            onBuffer();
+        }
+        else if( newState == 3 )
+        {
+            // current media is now playing
+            onPlay();
+        }
+        else if( newState == 4 )
+        {
+            // current media is now paused
+            onPause();
+        }
+        else if( newState == 5 )
+        {
+            // current media has stopped
+            onStop();
+        }
+        else if( newState == 6 )
+        {
+            // current media has ended
+            onEnd();
+        }
+        else if( newState == 7 )
+        {
+            // current media encountered error
+            onError();
+        }
+        prevState = newState;
+    }
+    else if( newState == 3 )
+    {
+        // current media is playing
+        onPlaying();
+    }
+    if( monitorTimerId == 0 )
+    {
+        monitorTimerId = setInterval("monitor()", 1000);
+    }
+};
+
+/* actions */
+
+function doGo(targetURL)
+{
+    var vlc = getVLC("vlc");
+
+    if( vlc )
+    {
+        vlc.playlist.items.clear();
+        while( vlc.playlist.items.count > 0 )
+        {
+            // clear() may return before the playlist has actually been cleared
+            // just wait for it to finish its job
+        }
+        var options = [":rtsp-tcp"];
+        var itemId = vlc.playlist.add(targetURL,"",options);
+        options = [];
+        if( itemId != -1 )
+        {
+            // play MRL
+            vlc.playlist.playItem(itemId);
+            if( monitorTimerId == 0 )
+            {
+                monitor();
+            }
+        }
+        else
+        {
+            alert("cannot play at the moment !");
+        }
+        doItemCount();
+    }
+}
+
+function doAdd(targetURL)
+{
+    var vlc = getVLC("vlc");
+    var options = [":vout-filter=deinterlace", ":deinterlace-mode=linear"];
+    if( vlc )
+    {
+        vlc.playlist.add(targetURL, "", options);
+        options = [];
+        doItemCount();
+    }
+}
+
+function doPlayOrPause()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        if( vlc.playlist.isPlaying && canPause )
+        {
+            vlc.playlist.togglePause();
+            //monitor();
+        }
+        else if( vlc.playlist.items.count > 0 )
+        {
+            vlc.playlist.play();
+            //monitor();
+        }
+        else
+        {
+            alert('nothing to play !');
+        }
+    }
+}
+
+function doStop()
+{
+    var vlc = getVLC("vlc");
+
+    if( vlc )
+        vlc.playlist.stop();
+
+    if( monitorTimerId != 0 )
+    {
+        clearInterval(monitorTimerId);
+        monitorTimerId = 0;
+    }
+    onStop();
+}
+
+function doPlaySlower()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.input.rate = vlc.input.rate / 2;
+}
+
+function doPlayFaster()
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+        vlc.input.rate = vlc.input.rate * 2;
+}
+
+function doMarqueeOption(option, value)
+{
+    var vlc = getVLC("vlc");
+    val = parseInt(value);
+    if( vlc )
+    {
+        if (option == 1)
+            vlc.video.marquee.color = val;
+        if (option == 2)
+            vlc.video.marquee.opacity = val;
+        if (option == 3)
+            vlc.video.marquee.position = value;
+        if (option == 4)
+            vlc.video.marquee.refresh = val;
+        if (option == 5)
+            vlc.video.marquee.size = val;
+        if (option == 6)
+            vlc.video.marquee.text = value;
+        if (option == 7)
+            vlc.video.marquee.timeout = val;
+        if (option == 8)
+            vlc.video.marquee.x = val;
+        if (option == 9)
+            vlc.video.marquee.y = val;
+    }
+}
+
+function doLogoOption(option, value)
+{
+    var vlc = getVLC("vlc");
+    if( vlc )
+    {
+        if (option == 1)
+            vlc.video.logo.file(value);
+        if (option == 2)
+            vlc.video.logo.position = value;
+        val = parseInt(value);
+        if (option == 3)
+            vlc.video.logo.opacity = val;
+        if (option == 4)
+            vlc.video.logo.repeat = val;
+        if (option == 5)
+            vlc.video.logo.delay = val;
+        if (option == 6)
+            vlc.video.logo.x = val;
+        if (option == 7)
+            vlc.video.logo.y = val;
+    }
+}
+
+/* events */
+
+function onOpen()
+{
+    document.getElementById("state").innerHTML = "Opening...";
+    document.getElementById("PlayOrPause").value = "Pause";
+}
+
+function onBuffer()
+{
+    document.getElementById("state").innerHTML = "Buffering...";
+    document.getElementById("PlayOrPause").value = "Pause";
+}
+
+function onPlay()
+{
+    document.getElementById("state").innerHTML = "Playing...";
+    document.getElementById("PlayOrPause").value = "Pause";
+    onPlaying();
+}
+
+function onEnd()
+{
+    document.getElementById("state").innerHTML = "End...";
+}
+
+var liveFeedText = ["Live", "((Live))", "(( Live ))", "((  Live  ))"];
+var liveFeedRoll = 0;
+
+function onPlaying()
+{
+    if( !inputTrackerScrolling )
+    {
+        var vlc = getVLC("vlc");
+        var info = document.getElementById("info");
+        if( vlc )
+        {
+            var mediaLen = vlc.input.length;
+            inputTrackerIgnoreChange = true;
+            if( mediaLen > 0 )
+            {
+                // seekable media
+                if( inputTracker )
+                {
+                    if( inputTracker.maxVal == 1.0 )
+                    {
+                        inputTracker.setDisabled(false);
+                        inputTracker.maxVal = 1.0;
+                    }
+                    inputTracker.setValue(vlc.input.position);
+                }
+                info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(mediaLen);
+            }
+            else
+            {
+                // non-seekable "live" media
+                if( inputTracker )
+                {
+                    if( inputTracker.maxVal != 0.0 )
+                    {
+                        inputTracker.maxVal = 0.0;
+                        inputTracker.setValue(0.0);
+                        inputTracker.setDisabled(true);
+                    }
+                }
+                liveFeedRoll = liveFeedRoll & 3;
+                info.innerHTML = liveFeedText[liveFeedRoll++];
+            }
+            inputTrackerIgnoreChange  = false;
+        }
+    }
+}
+
+function onPause()
+{
+    document.getElementById("state").innerHTML = "Paused...";
+    document.getElementById("PlayOrPause").value = " Play ";
+}
+
+function onStop()
+{
+    var vlc = getVLC("vlc");
+
+    if( inputTracker )
+    {
+        if( !inputTracker.disabled )
+        {
+            inputTracker.setValue(inputTracker.minVal);
+            inputTracker.setDisabled(true);
+        }
+    }
+
+    document.getElementById("info").innerHTML = "-:--:--/-:--:--";
+    document.getElementById("state").innerHTML = "Stopped...";
+    document.getElementById("PlayOrPause").value = " Play ";
+}
+
+function onError()
+{
+    var vlc = getVLC("vlc");
+
+    document.getElementById("state").innerHTML = "Error...";
+}
+
+function onInputTrackerScrollStart()
+{
+    inputTrackerScrolling = true;
+}
+
+function onInputTrackerScrollEnd(inputTracker, value, pos)
+{
+    inputTrackerScrolling = false;
+}
+
+function onInputTrackerChange(inputTracker, value, pos)
+{
+    if( !inputTrackerIgnoreChange )
+    {
+        var vlc = getVLC("vlc");
+        if( vlc )
+        {
+            if( (vlc.input.state == 3) && (vlc.input.position != value) )
+            {
+                var info = document.getElementById("info");
+                vlc.input.position = value;
+                info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length);
+            }
+        }
+    }
+}
+
+//-->
+</SCRIPT>
+</BODY>
+</HTML>