Update mozilla test page.
authorJean-Paul Saman <jpsaman@videolan.org>
Tue, 17 Jun 2008 21:32:59 +0000 (23:32 +0200)
committerJean-Paul Saman <jpsaman@videolan.org>
Wed, 18 Jun 2008 09:39:23 +0000 (11:39 +0200)
projects/mozilla/test.html

index 66bc3e9..b7b723d 100644 (file)
-<HTML>
-<TITLE>VLC Mozilla plug-in test page</TITLE>
-<BODY>
-<TABLE>
-<TR><TD colspan="2">
-MRL:
-<INPUT size="90" id="targetTextField" value="">
-<INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">
-</TD></TR>
-<TR><TD colspan="2">
-<EMBED  type="application/x-vlc-plugin" pluginspage="http://www.videolan.org/" version="VideoLAN.VLCPlugin.2"
-        width="640"
-        height="480"
-        id="vlc">
-</EMBED>
-</TD></TR>
-<TR><TD>
-<INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause()'>
-<INPUT type=button value="Stop" onClick='document.getElementById("vlc").playlist.stop();'>
-&nbsp;
-<INPUT type=button value=" << " onClick='doPlaySlower();'>
-<INPUT type=button value=" >> " onClick='doPlayFaster();'>
-&nbsp;
-<INPUT type=button value="Version" onClick='alert(document.getElementById("vlc"));'>
-<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='document.getElementById("vlc").audio.toggleMute();'>
-</TD><TD width="15%">
-<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
-</TD></TR>
-</TABLE>
-<SCRIPT LANGUAGE="Javascript">
-<!--
-var timerId = 0;
-
-function updateVolume(deltaVol)
-{
-    var vlc = document.getElementById("vlc");
-    vlc.audio.volume += deltaVol;
-    document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
-};
-function formatTime(timeVal)
-{
-    var timeHour = timeVal;
-    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 onPlay()
-{
-    document.getElementById("PlayOrPause").value = "Pause";
-};
-function onPause()
-{
-    document.getElementById("PlayOrPause").value = " Play ";
-};
-function onStop()
-{
-    document.getElementById("info").innerHTML = "-:--:--/-:--:--";
-    document.getElementById("PlayOrPause").value = " Play ";
-};
-var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "((  Live  ))");
-var liveFeedRoll = 0;
-
-function doUpdate()
-{
-    var vlc = document.getElementById("vlc");
-    if( vlc.playlist.isPlaying )
-    {
-        if( vlc.input.length > 0 )
-        {
-            // seekable stream
-            document.getElementById("info").innerHTML = formatTime(vlc.input.time/1000)+"/"+formatTime(vlc.input.length/1000);
-            document.getElementById("PlayOrPause").Enabled = true;
-        }
-        else {
-            liveFeedRoll = liveFeedRoll & 3;
-            document.getElementById("info").innerText = liveFeedText[liveFeedRoll++];
-        }
-        timerId = setTimeout("doUpdate()", 1000);
-    }
-    else
-    {
-        onStop();
-        timerId = 0;
-    }
-};
-function doGo(targetURL)
-{
-       var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
-       document.getElementById("vlc").playlist.add(targetURL, null, options);
-};
-function doPlayOrPause()
-{
-    var vlc = document.getElementById("vlc");
-    if( vlc.playlist.isPlaying )
-    {
-        vlc.playlist.pause();
-    }
-    else
-    {
-        vlc.playlist.play();
-    }
-};
-function doPlaySlower()
-{
-    var vlc = document.getElementById("vlc");
-    vlc.input.rate = vlc.input.rate / 2;
-};
-function doPlayFaster()
-{
-    var vlc = document.getElementById("vlc");
-    vlc.input.rate = vlc.input.rate * 2;
-};
-function vlcPlayEvent()
-{
-    if( ! timerId )
-    {
-        timerId = setTimeout("doUpdate()", 1000);
-    }
-    onPlay();
-};
-function vlcPauseEvent()
-{
-    if( timerId )
-    {
-        clearTimeout(timerId)
-        timerId = 0;
-    }
-    onPause();
-};
-function vlcStopEvent()
-{
-    if( timerId )
-    {
-        clearTimeout(timerId)
-        timerId = 0;
-    }
-    onStop();
-};
-//-->
-</SCRIPT>
-</BODY>
-</HTML>
+<!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
+    inputTracker = new Bs_Slider();\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
+    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
+            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
+       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=" >> " onClick='doPlayFaster();'>\r
+<INPUT type=button value="Backward" onClick='doBackwardPlay(500);'>\r
+<INPUT type=button value="Forward" onClick='doForwardPlay(500);'>\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='doState();'>\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='getVLC("vlc").playlist.clear(); doItemCount();'>\r
+<INPUT size=4 value="1:1" id="aspect"><INPUT type=submit value="AspectRatio" onClick="doAspectRatio(document.getElementById('aspect').value);">\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>Messages:\r
+<INPUT type=button value="Messages" onClick='doMessages();'>\r
+Verbosity:\r
+<INPUT size=2 value="1" id="verbosity" onClick="doVerbosity(document.getElementById('verbosity').value);">\r
+<INPUT type=button value=" + " onClick='doVerbosity(1);'>\r
+<INPUT type=button value=" - " onClick='doVerbosity(-1);'>\r
+</TD>\r
+<TD>\r
+<DIV id="message" style="text-align:center">no message</DIV>\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
+</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
+</TABLE>\r
+<SCRIPT language="javascript">\r
+<!--\r
+\r
+var rate = 0;\r
+var prevState = 0;\r
+var monitorTimerId = 0;\r
+var rateTimerId = 0;\r
+var inputTrackerScrolling = false;\r
+var inputTrackerIgnoreChange = false;\r
+\r
+function doSetSlider()\r
+{\r
+   var vlc = getVLC("vlc");\r
+\r
+   if (vlc.input)\r
+   {\r
+     // set slider to new position\r
+     vlc.input.time = (vlc.input.length/2);\r
+   }\r
+};\r
+\r
+function doGetPosition()\r
+{\r
+   var vlc = getVLC("vlc");\r
+\r
+   if (vlc.input)\r
+   {\r
+     // set slider to new position\r
+     alert( "position is " + vlc.input.time);\r
+   }\r
+};\r
+\r
+function doForwardPlay(speed)\r
+{\r
+   if (rateTimerId == 0)\r
+   {\r
+       rateTimerId = setInterval("ratechange()", speed);\r
+       rate = speed;\r
+   }\r
+   else rate = rate + speed;\r
+};\r
+\r
+function doBackwardPlay(speed)\r
+{\r
+   if (rateTimerId == 0)\r
+   {\r
+       rateTimerId = setInterval("ratechange()", speed);\r
+       rate = -speed;\r
+   }\r
+   else rate = rate - speed;\r
+};\r
+\r
+function ratechange()\r
+{\r
+    if (rateTimerId != 0)\r
+    {\r
+        var vlc = getVLC("vlc");\r
+        vlc.input.time = vlc.input.time + rate;\r
+    }\r
+};\r
+\r
+function doVerbosity(value)\r
+{\r
+    var vlc = getVLC("vlc");\r
+    vlc.log.verbosity = vlc.log.verbosity + value;\r
+    document.getElementById("verbosity").value = vlc.log.verbosity;\r
+};\r
+\r
+function doAudioChannel(value)\r
+{\r
+    var vlc = getVLC("vlc");\r
+    vlc.audio.channel = parseInt(value);\r
+};\r
+\r
+function doAudioTrack(value)\r
+{\r
+    var vlc = getVLC("vlc");\r
+    vlc.audio.track = vlc.audio.track + value;\r
+    document.getElementById("trackTextField").innerHTML = vlc.audio.track;\r
+};\r
+\r
+function doAspectRatio(value)\r
+{\r
+   var vlc = getVLC("vlc");\r
+   vlc.video.aspectRatio = value;\r
+   document.getElementById("aspect").value = vlc.video.aspectRatio;\r
+}\r
+\r
+function doItemCount()\r
+{\r
+   var vlc = getVLC("vlc");\r
+   var count = vlc.playlist.itemCount;\r
+   document.getElementById("itemCount").value = " Items " + count + " ";\r
+};\r
+\r
+function doRemoveItem(item)\r
+{\r
+   var vlc = getVLC("vlc");\r
+   vlc.playlist.removeItem(item);\r
+};\r
+\r
+function doMessages()\r
+{\r
+    var vlc = getVLC("vlc");\r
+\r
+    if( vlc.log.messages.count > 0 )\r
+    {\r
+        // there is one or more messages in the log\r
+        var iter = vlc.log.messages.iterator();\r
+        while( iter.hasNext )\r
+        {\r
+            var msg = iter.next();\r
+            if( msg.severity <= 1 )\r
+            {\r
+                document.getElementById("message").innerHTML = msg.message;\r
+            }\r
+        }\r
+        // clear the log once finished to avoid clogging\r
+        vlc.log.messages.clear();\r
+    }\r
+};\r
+\r
+function updateVolume(deltaVol)\r
+{\r
+    var vlc = getVLC("vlc");\r
+    vlc.audio.volume += deltaVol;\r
+    document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";\r
+};\r
+\r
+function formatTime(timeVal)\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 = 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 is playing forward\r
+       onForward();\r
+    }\r
+    else if( newState == 7 )\r
+    {\r
+        // current media is playing backward\r
+       onBackward();\r
+    }\r
+    else if( newState == 8 )\r
+    {\r
+       // current media has ended\r
+       onEnd();\r
+    }\r
+    else if( newState == 9 )\r
+    {\r
+        // current media encountered error\r
+        onError();\r
+    }\r
+};\r
+\r
+function monitor()\r
+{\r
+    var vlc = getVLC("vlc");\r
+    var newState = vlc.input.state;\r
+\r
+    if( vlc.log.messages.count > 0 )\r
+    {\r
+        // there is one or more messages in the log\r
+        var iter = vlc.log.messages.iterator();\r
+        while( iter.hasNext )\r
+        {\r
+            var msg = iter.next();\r
+            if( msg.severity == 1 )\r
+            {\r
+                alert( msg.message );\r
+            }\r
+           document.getElementById("message").innerHTML = msg.message;\r
+        }\r
+        // clear the log once finished to avoid clogging\r
+        vlc.log.messages.clear();\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 is playing forward\r
+           onForward();\r
+       }\r
+       else if( newState == 7 )\r
+       {\r
+           // current media is playing backward\r
+           onBackward();\r
+       }\r
+       else if( newState == 8 )\r
+       {\r
+           // current media has ended\r
+            onEnd();\r
+        }\r
+       else if( newState == 9 )\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
+    vlc.playlist.clear();\r
+    while( vlc.playlist.itemCount > 0 )\r
+    {\r
+        // clear() may return before the playlist has actually been cleared\r
+        // just wait for it to finish its job\r
+    }\r
+    //vlc.playlist.add(targetURL);\r
+    //vlc.playlist.play();\r
+\r
+    var itemId = vlc.playlist.add(targetURL);\r
+    if( itemId != -1 )\r
+    {\r
+        // clear the message log and enable error logging\r
+        vlc.log.verbosity = 1;\r
+        vlc.log.messages.clear();\r
+        // play MRL\r
+        vlc.playlist.play();\r
+        if( monitorTimerId == 0 )\r
+        {\r
+            monitor();\r
+        }\r
+    }\r
+    else\r
+    {\r
+        // disable log\r
+        vlc.log.verbosity = -1;\r
+        alert("cannot play at the moment !");\r
+    }\r
+    doItemCount();\r
+\r
+    if (rateTimerId != 0)\r
+    {\r
+        clearInterval("ratechange()");\r
+    }\r
+    rateTimerId = 0;\r
+};\r
+\r
+function doAdd(targetURL)\r
+{\r
+    var vlc = getVLC("vlc");\r
+    var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");\r
+    vlc.playlist.add(targetURL);\r
+    doItemCount();\r
+};\r
+\r
+function doPlayOrPause()\r
+{\r
+    var vlc = getVLC("vlc");\r
+    if( vlc.playlist.isPlaying )\r
+    {\r
+        vlc.playlist.togglePause();\r
+       monitor();\r
+    }\r
+    else if( vlc.playlist.itemCount > 0 )\r
+    {\r
+       // clear the message log and enable error logging\r
+        vlc.log.verbosity = 1;\r
+        vlc.log.messages.clear();\r
+        vlc.playlist.play();\r
+        monitor();\r
+    }\r
+    else\r
+    {\r
+       // disable log\r
+        vlc.log.verbosity = -1;\r
+        alert('nothing to play !');\r
+    }\r
+    if (rateTimerId != 0)\r
+    {\r
+        clearInterval("ratechange()");\r
+    }\r
+    rateTimerId = 0;\r
+};\r
+\r
+function doStop()\r
+{\r
+    getVLC("vlc").playlist.stop();\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
+    vlc.input.rate = vlc.input.rate / 2;\r
+};\r
+\r
+function doPlayFaster()\r
+{\r
+    var vlc = getVLC("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 onForward()\r
+{   // Event is reserved for future enhancements\r
+    document.getElementById("state").innerHTML = "Forward playing...";\r
+};\r
+\r
+function onBackward()\r
+{   // Event is reserved for future enhancements\r
+    document.getElementById("state").innerHTML = "Backward playing...";\r
+};\r
+\r
+function onEnd()\r
+{\r
+    document.getElementById("state").innerHTML = "End...";\r
+};\r
+\r
+\r
+var liveFeedText = new Array("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
+        var mediaLen = vlc.input.length;\r
+        inputTrackerIgnoreChange  = true;\r
+        if( mediaLen > 0 )\r
+        {\r
+            // seekable media\r
+            if( inputTracker.maxVal == 1.0 )\r
+            {\r
+                inputTracker.setDisabled(false);\r
+                inputTracker.maxVal = 1.0;\r
+            }\r
+            inputTracker.setValue(vlc.input.position);\r
+            info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(mediaLen);\r
+        }\r
+        else\r
+        {\r
+            // non-seekable "live" media\r
+            if( inputTracker.maxVal != 0.0 )\r
+            {\r
+                inputTracker.maxVal = 0.0;\r
+                inputTracker.setValue(0.0);\r
+                inputTracker.setDisabled(true);\r
+            }\r
+            liveFeedRoll = liveFeedRoll & 3;\r
+            info.innerHTML = liveFeedText[liveFeedRoll++];\r
+        }\r
+        inputTrackerIgnoreChange  = false;\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
+    // disable logging\r
+    vlc.log.verbosity = -1;\r
+\r
+    if( ! inputTracker.disabled )\r
+    {\r
+        inputTracker.setValue(inputTracker.minVal);\r
+        inputTracker.setDisabled(true);\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
+    if( vlc.log.messages.count > 0 )\r
+    {\r
+        // there is one or more messages in the log\r
+        var iter = vlc.log.messages.iterator();\r
+        while( iter.hasNext )\r
+        {\r
+            var msg = iter.next();\r
+            if( msg.severity <= 1 )\r
+            {\r
+                alert( msg.message );\r
+            }\r
+            document.getElementById("message").innerHTML = msg.message;\r
+        }\r
+        // clear the log once finished to avoid clogging\r
+        vlc.log.messages.clear();\r
+    }\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.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
+</SCRIPT>\r
+</BODY>\r
+</HTML>\r