Commit 499e50d7 authored by Jean-Paul Saman's avatar Jean-Paul Saman

mozilla: cleanup test.html plugin testing page.

parent bf8c4fd1
...@@ -59,7 +59,7 @@ function init() ...@@ -59,7 +59,7 @@ function init()
} }
} }
} }
}; }
function getVLC(name) function getVLC(name)
{ {
...@@ -76,12 +76,12 @@ function getVLC(name) ...@@ -76,12 +76,12 @@ function getVLC(name)
{ {
return document.getElementById(name); return document.getElementById(name);
} }
}; }
function onVLCPluginReady() function onVLCPluginReady()
{ {
updateVolume(0); updateVolume(0);
}; }
//--></SCRIPT> //--></SCRIPT>
...@@ -136,9 +136,9 @@ Insert Slider widget ...@@ -136,9 +136,9 @@ Insert Slider widget
<INPUT type=button value="Stop" onClick='doStop();'> <INPUT type=button value="Stop" onClick='doStop();'>
&nbsp; &nbsp;
<INPUT type=button value=" << " onClick='doPlaySlower();'> <INPUT type=button value=" << " onClick='doPlaySlower();'>
<INPUT type=button value="Reverse" onClick='doReverse();'>
<INPUT type=button value=" >> " onClick='doPlayFaster();'> <INPUT type=button value=" >> " onClick='doPlayFaster();'>
<INPUT type=button value="Backward" onClick='doBackwardPlay(500);'> &nbsp;
<INPUT type=button value="Forward" onClick='doForwardPlay(500);'>
<INPUT type=button value="Fullscreen" onClick='getVLC("vlc").video.toggleFullscreen();'> <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="Version" onClick='alert("vlc " + getVLC("vlc").VersionInfo);'>
<INPUT type=button value=" State " onClick='alert("state: " + getVLC("vlc").input.state);'> <INPUT type=button value=" State " onClick='alert("state: " + getVLC("vlc").input.state);'>
...@@ -223,7 +223,6 @@ Verbosity: ...@@ -223,7 +223,6 @@ Verbosity:
var rate = 0; var rate = 0;
var prevState = 0; var prevState = 0;
var monitorTimerId = 0; var monitorTimerId = 0;
var rateTimerId = 0;
var inputTracker; var inputTracker;
var inputTrackerScrolling = false; var inputTrackerScrolling = false;
var inputTrackerIgnoreChange = false; var inputTrackerIgnoreChange = false;
...@@ -233,96 +232,84 @@ function doSetSlider() ...@@ -233,96 +232,84 @@ function doSetSlider()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if (vlc.input)
{
// set slider to new position // set slider to new position
if( vlc )
vlc.input.time = (vlc.input.length/2); vlc.input.time = (vlc.input.length/2);
} }
};
function doGetPosition() function doGetPosition()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if (vlc.input)
{
// set slider to new position // set slider to new position
if (vlc)
alert( "position is " + vlc.input.time); alert( "position is " + vlc.input.time);
} }
};
function doForwardPlay(speed)
{
if (rateTimerId == 0)
{
rateTimerId = setInterval("ratechange()", speed);
rate = speed;
}
else rate = rate + speed;
};
function doBackwardPlay(speed)
{
if (rateTimerId == 0)
{
rateTimerId = setInterval("ratechange()", speed);
rate = -speed;
}
else rate = rate - speed;
};
function ratechange() function doReverse(rate)
{ {
if (rateTimerId != 0)
{
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
vlc.input.time = vlc.input.time + rate; if( vlc )
} vlc.input.rate = -1.0 * vlc.input.rate;
}; }
function doVerbosity(value) function doVerbosity(value)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
vlc.log.verbosity = vlc.log.verbosity + value; vlc.log.verbosity = vlc.log.verbosity + value;
document.getElementById("verbosity").value = vlc.log.verbosity; document.getElementById("verbosity").value = vlc.log.verbosity;
}; }
}
function doAudioChannel(value) function doAudioChannel(value)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
vlc.audio.channel = parseInt(value); vlc.audio.channel = parseInt(value);
}; }
function doAudioTrack(value) function doAudioTrack(value)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
vlc.audio.track = vlc.audio.track + value; vlc.audio.track = vlc.audio.track + value;
document.getElementById("trackTextField").innerHTML = vlc.audio.track; document.getElementById("trackTextField").innerHTML = vlc.audio.track;
}; }
}
function doAspectRatio(value) function doAspectRatio(value)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
vlc.video.aspectRatio = value; vlc.video.aspectRatio = value;
}; }
function doSubtitle(value) function doSubtitle(value)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
vlc.video.subtitle = vlc.video.subtitle + value; vlc.video.subtitle = vlc.video.subtitle + value;
document.getElementById("spuTextField").innerHTML = vlc.video.subtitle; document.getElementById("spuTextField").innerHTML = vlc.video.subtitle;
}; }
}
function doTelxPage(value) function doTelxPage(value)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
vlc.video.teletext = parseInt(value); vlc.video.teletext = parseInt(value);
}; }
function doToggleTeletext() function doToggleTeletext()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
vlc.video.toggleTeletext(); vlc.video.toggleTeletext();
if (telxState) if (telxState)
{ {
...@@ -334,25 +321,32 @@ function doToggleTeletext() ...@@ -334,25 +321,32 @@ function doToggleTeletext()
document.getElementById("telx").innerHTML = "Teletext off"; document.getElementById("telx").innerHTML = "Teletext off";
telxState = false; telxState = false;
} }
}
} }
function doItemCount() function doItemCount()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
var count = vlc.playlist.itemCount; var count = vlc.playlist.itemCount;
document.getElementById("itemCount").value = " Items " + count + " "; document.getElementById("itemCount").value = " Items " + count + " ";
}; }
}
function doRemoveItem(item) function doRemoveItem(item)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
vlc.playlist.removeItem(item); vlc.playlist.removeItem(item);
}; }
function doMessages() function doMessages()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
if( vlc.log.messages.count > 0 ) if( vlc.log.messages.count > 0 )
{ {
// there is one or more messages in the log // there is one or more messages in the log
...@@ -368,14 +362,18 @@ function doMessages() ...@@ -368,14 +362,18 @@ function doMessages()
// clear the log once finished to avoid clogging // clear the log once finished to avoid clogging
vlc.log.messages.clear(); vlc.log.messages.clear();
} }
}; }
}
function updateVolume(deltaVol) function updateVolume(deltaVol)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
vlc.audio.volume += deltaVol; vlc.audio.volume += deltaVol;
document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%"; document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
}; }
}
function formatTime(timeVal) function formatTime(timeVal)
{ {
...@@ -392,12 +390,15 @@ function formatTime(timeVal) ...@@ -392,12 +390,15 @@ function formatTime(timeVal)
return timeHour+":"+timeMin+":"+timeSec; return timeHour+":"+timeMin+":"+timeSec;
else else
return timeMin+":"+timeSec; return timeMin+":"+timeSec;
}; }
function doState() function doState()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
var newState = vlc.input.state; var newState = 0;
if( vlc )
newState = vlc.input.state;
if( newState == 0 ) if( newState == 0 )
{ {
...@@ -430,31 +431,25 @@ function doState() ...@@ -430,31 +431,25 @@ function doState()
onStop(); onStop();
} }
else if( newState == 6 ) else if( newState == 6 )
{
// current media is playing forward
onForward();
}
else if( newState == 7 )
{
// current media is playing backward
onBackward();
}
else if( newState == 8 )
{ {
// current media has ended // current media has ended
onEnd(); onEnd();
} }
else if( newState == 9 ) else if( newState == 7 )
{ {
// current media encountered error // current media encountered error
onError(); onError();
} }
}; }
function monitor() function monitor()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
var newState = vlc.input.state; var newState = 0;
if( vlc )
{
newState = vlc.input.state;
if( vlc.log.messages.count > 0 ) if( vlc.log.messages.count > 0 )
{ {
...@@ -472,6 +467,7 @@ function monitor() ...@@ -472,6 +467,7 @@ function monitor()
// clear the log once finished to avoid clogging // clear the log once finished to avoid clogging
vlc.log.messages.clear(); vlc.log.messages.clear();
} }
}
if( prevState != newState ) if( prevState != newState )
{ {
...@@ -506,21 +502,11 @@ function monitor() ...@@ -506,21 +502,11 @@ function monitor()
onStop(); onStop();
} }
else if( newState == 6 ) else if( newState == 6 )
{
// current media is playing forward
onForward();
}
else if( newState == 7 )
{
// current media is playing backward
onBackward();
}
else if( newState == 8 )
{ {
// current media has ended // current media has ended
onEnd(); onEnd();
} }
else if( newState == 9 ) else if( newState == 7 )
{ {
// current media encountered error // current media encountered error
onError(); onError();
...@@ -544,6 +530,8 @@ function doGo(targetURL) ...@@ -544,6 +530,8 @@ function doGo(targetURL)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
vlc.playlist.clear(); vlc.playlist.clear();
while( vlc.playlist.itemCount > 0 ) while( vlc.playlist.itemCount > 0 )
{ {
...@@ -573,25 +561,25 @@ function doGo(targetURL) ...@@ -573,25 +561,25 @@ function doGo(targetURL)
alert("cannot play at the moment !"); alert("cannot play at the moment !");
} }
doItemCount(); doItemCount();
if (rateTimerId != 0)
{
clearInterval("ratechange()");
} }
rateTimerId = 0; }
};
function doAdd(targetURL) function doAdd(targetURL)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear"); var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
if( vlc )
{
vlc.playlist.add(targetURL); vlc.playlist.add(targetURL);
doItemCount(); doItemCount();
}; }
}
function doPlayOrPause() function doPlayOrPause()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
if( vlc.playlist.isPlaying ) if( vlc.playlist.isPlaying )
{ {
vlc.playlist.togglePause(); vlc.playlist.togglePause();
...@@ -611,35 +599,37 @@ function doPlayOrPause() ...@@ -611,35 +599,37 @@ function doPlayOrPause()
vlc.log.verbosity = -1; vlc.log.verbosity = -1;
alert('nothing to play !'); alert('nothing to play !');
} }
if (rateTimerId != 0)
{
clearInterval("ratechange()");
} }
rateTimerId = 0; }
};
function doStop() function doStop()
{ {
getVLC("vlc").playlist.stop(); var vlc = getVLC("vlc");
if( vlc )
vlc.playlist.stop();
if( monitorTimerId != 0 ) if( monitorTimerId != 0 )
{ {
clearInterval(monitorTimerId); clearInterval(monitorTimerId);
monitorTimerId = 0; monitorTimerId = 0;
} }
onStop(); onStop();
}; }
function doPlaySlower() function doPlaySlower()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
vlc.input.rate = vlc.input.rate / 2; vlc.input.rate = vlc.input.rate / 2;
}; }
function doPlayFaster() function doPlayFaster()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
vlc.input.rate = vlc.input.rate * 2; vlc.input.rate = vlc.input.rate * 2;
}; }
/* events */ /* events */
...@@ -647,36 +637,25 @@ function onOpen() ...@@ -647,36 +637,25 @@ function onOpen()
{ {
document.getElementById("state").innerHTML = "Opening..."; document.getElementById("state").innerHTML = "Opening...";
document.getElementById("PlayOrPause").value = "Pause"; document.getElementById("PlayOrPause").value = "Pause";
}; }
function onBuffer() function onBuffer()
{ {
document.getElementById("state").innerHTML = "Buffering..."; document.getElementById("state").innerHTML = "Buffering...";
document.getElementById("PlayOrPause").value = "Pause"; document.getElementById("PlayOrPause").value = "Pause";
}; }
function onPlay() function onPlay()
{ {
document.getElementById("state").innerHTML = "Playing..."; document.getElementById("state").innerHTML = "Playing...";
document.getElementById("PlayOrPause").value = "Pause"; document.getElementById("PlayOrPause").value = "Pause";
onPlaying(); onPlaying();
}; }
function onForward()
{ // Event is reserved for future enhancements
document.getElementById("state").innerHTML = "Forward playing...";
};
function onBackward()
{ // Event is reserved for future enhancements
document.getElementById("state").innerHTML = "Backward playing...";
};
function onEnd() function onEnd()
{ {
document.getElementById("state").innerHTML = "End..."; document.getElementById("state").innerHTML = "End...";
}; }
var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))"); var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))");
var liveFeedRoll = 0; var liveFeedRoll = 0;
...@@ -687,6 +666,8 @@ function onPlaying() ...@@ -687,6 +666,8 @@ function onPlaying()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
var info = document.getElementById("info"); var info = document.getElementById("info");
if( vlc )
{
var mediaLen = vlc.input.length; var mediaLen = vlc.input.length;
inputTrackerIgnoreChange = true; inputTrackerIgnoreChange = true;
if( mediaLen > 0 ) if( mediaLen > 0 )
...@@ -720,17 +701,20 @@ function onPlaying() ...@@ -720,17 +701,20 @@ function onPlaying()
} }
inputTrackerIgnoreChange = false; inputTrackerIgnoreChange = false;
} }
}; }
}
function onPause() function onPause()
{ {
document.getElementById("state").innerHTML = "Paused..."; document.getElementById("state").innerHTML = "Paused...";
document.getElementById("PlayOrPause").value = " Play "; document.getElementById("PlayOrPause").value = " Play ";
}; }
function onStop() function onStop()
{ {
// disable logging // disable logging
var vlc = getVLC("vlc");
if( vlc )
vlc.log.verbosity = -1; vlc.log.verbosity = -1;
if( inputTracker ) if( inputTracker )
...@@ -741,16 +725,19 @@ function onStop() ...@@ -741,16 +725,19 @@ function onStop()
inputTracker.setDisabled(true); inputTracker.setDisabled(true);
} }
} }
document.getElementById("info").innerHTML = "-:--:--/-:--:--"; document.getElementById("info").innerHTML = "-:--:--/-:--:--";
document.getElementById("state").innerHTML = "Stopped..."; document.getElementById("state").innerHTML = "Stopped...";
document.getElementById("PlayOrPause").value = " Play "; document.getElementById("PlayOrPause").value = " Play ";
}; }
function onError() function onError()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
document.getElementById("state").innerHTML = "Error..."; document.getElementById("state").innerHTML = "Error...";
if( vlc )
{
if( vlc.log.messages.count > 0 ) if( vlc.log.messages.count > 0 )
{ {
// there is one or more messages in the log // there is one or more messages in the log
...@@ -767,23 +754,26 @@ function onError() ...@@ -767,23 +754,26 @@ function onError()
// clear the log once finished to avoid clogging // clear the log once finished to avoid clogging
vlc.log.messages.clear(); vlc.log.messages.clear();
} }
}; }
}
function onInputTrackerScrollStart() function onInputTrackerScrollStart()
{ {
inputTrackerScrolling = true; inputTrackerScrolling = true;
}; }
function onInputTrackerScrollEnd(inputTracker, value, pos) function onInputTrackerScrollEnd(inputTracker, value, pos)
{ {
inputTrackerScrolling = false; inputTrackerScrolling = false;
}; }
function onInputTrackerChange(inputTracker, value, pos) function onInputTrackerChange(inputTracker, value, pos)
{ {
if( ! inputTrackerIgnoreChange ) if( !inputTrackerIgnoreChange )
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc )
{
if( (vlc.input.state == 3) && (vlc.input.position != value) ) if( (vlc.input.state == 3) && (vlc.input.position != value) )
{ {
var info = document.getElementById("info"); var info = document.getElementById("info");
...@@ -791,7 +781,9 @@ function onInputTrackerChange(inputTracker, value, pos) ...@@ -791,7 +781,9 @@ function onInputTrackerChange(inputTracker, value, pos)
info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length); info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length);
} }
} }
}; }
}
//--> //-->
</SCRIPT> </SCRIPT>
</BODY> </BODY>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment