Commit b757e867 authored by Jean-Paul Saman's avatar Jean-Paul Saman

activex; sync test.html testpage with mozilla one.

parent 499e50d7
...@@ -16,25 +16,29 @@ ...@@ -16,25 +16,29 @@
<SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/components/slider/Bs_Slider.class.js"></SCRIPT> <SCRIPT type="text/javascript" src="blueshoes-4.5/javascript/components/slider/Bs_Slider.class.js"></SCRIPT>
<SCRIPT language="JavaScript"><!-- <SCRIPT language="JavaScript"><!--
function init(){ function init()
{
inputTracker = new Bs_Slider(); inputTracker = new Bs_Slider();
inputTracker.attachOnChange(onInputTrackerChange); if (inputTracker)
inputTracker.attachOnSlideStart(onInputTrackerScrollStart); {
inputTracker.attachOnSlideEnd(onInputTrackerScrollEnd); inputTracker.attachOnChange(onInputTrackerChange);
inputTracker.width = 530 ; inputTracker.attachOnSlideStart(onInputTrackerScrollStart);
inputTracker.height = 15; inputTracker.attachOnSlideEnd(onInputTrackerScrollEnd);
inputTracker.minVal = 0; inputTracker.width = 530 ;
inputTracker.maxVal = 1.0; inputTracker.height = 15;
inputTracker.valueDefault = 0; inputTracker.minVal = 0;
inputTracker.valueInterval = 1/530; inputTracker.maxVal = 1.0;
inputTracker.setDisabled(true); inputTracker.valueDefault = 0;
inputTracker.imgDir = 'blueshoes-4.5/javascript/components/slider/img/'; inputTracker.valueInterval = 1/530;
inputTracker.setBackgroundImage('aluminumalloyvolcanic/horizontal_background.gif', 'repeat'); inputTracker.setDisabled(true);
inputTracker.setArrowIconLeft('aluminumalloyvolcanic/horizontal_backgroundLeft.gif', 2, 19); inputTracker.imgDir = 'blueshoes-4.5/javascript/components/slider/img/';
inputTracker.setArrowIconRight('aluminumalloyvolcanic/horizontal_backgroundRight.gif', 2, 19); inputTracker.setBackgroundImage('aluminumalloyvolcanic/horizontal_background.gif', 'repeat');
inputTracker.setSliderIcon('aluminumalloyvolcanic/horizontal_knob.gif', 15, 19); inputTracker.setArrowIconLeft('aluminumalloyvolcanic/horizontal_backgroundLeft.gif', 2, 19);
inputTracker.useInputField = 0; inputTracker.setArrowIconRight('aluminumalloyvolcanic/horizontal_backgroundRight.gif', 2, 19);
inputTracker.draw('inputTrackerDiv'); inputTracker.setSliderIcon('aluminumalloyvolcanic/horizontal_knob.gif', 15, 19);
inputTracker.useInputField = 0;
inputTracker.draw('inputTrackerDiv');
}
if( navigator.appName.indexOf("Microsoft Internet")==-1 ) if( navigator.appName.indexOf("Microsoft Internet")==-1 )
{ {
...@@ -47,36 +51,37 @@ function init(){ ...@@ -47,36 +51,37 @@ function init(){
else else
{ {
/* Explorer loads plugins asynchronously */ /* Explorer loads plugins asynchronously */
document.onreadystatechange=function() { document.onreadystatechange=function()
{
if( document.readyState == 'complete' ) if( document.readyState == 'complete' )
{ {
onVLCPluginReady(); onVLCPluginReady();
} }
} }
} }
}; }
function getVLC(name) function getVLC(name)
{ {
if (window.document[name]) if (window.document[name])
{ {
return window.document[name]; return window.document[name];
} }
if (navigator.appName.indexOf("Microsoft Internet")==-1) if (navigator.appName.indexOf("Microsoft Internet")==-1)
{ {
if (document.embeds && document.embeds[name]) if (document.embeds && document.embeds[name])
return document.embeds[name]; return document.embeds[name];
} }
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1) else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{ {
return document.getElementById(name); return document.getElementById(name);
} }
}; }
function onVLCPluginReady() function onVLCPluginReady()
{ {
updateVolume(0); updateVolume(0);
}; }
//--></SCRIPT> //--></SCRIPT>
...@@ -90,7 +95,7 @@ MRL: ...@@ -90,7 +95,7 @@ MRL:
</TD></TR> </TD></TR>
<TR><TD align="center" colspan="2"> <TR><TD align="center" colspan="2">
<!-- <!--
Insert VideoLAN.VLCPlugin.2 Insert VideoLAN.VLCPlugin.2
--> -->
<OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" <OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
width="640" width="640"
...@@ -102,12 +107,14 @@ Insert VideoLAN.VLCPlugin.2 ...@@ -102,12 +107,14 @@ Insert VideoLAN.VLCPlugin.2
<param name="AutoLoop" value="False" /> <param name="AutoLoop" value="False" />
<param name="AutoPlay" value="False" /> <param name="AutoPlay" value="False" />
<param name="Volume" value="50" /> <param name="Volume" value="50" />
<param name="toolbar" value="true" />
<param name="StartTime" value="0" /> <param name="StartTime" value="0" />
<EMBED pluginspage="http://www.videolan.org" <EMBED pluginspage="http://www.videolan.org"
type="application/x-vlc-plugin" type="application/x-vlc-plugin"
version="VideoLAN.VLCPlugin.2" version="VideoLAN.VLCPlugin.2"
width="640" width="640"
height="480" height="480"
toolbar="true"
name="vlc"> name="vlc">
</EMBED> </EMBED>
</OBJECT> </OBJECT>
...@@ -129,13 +136,13 @@ Insert Slider widget ...@@ -129,13 +136,13 @@ 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='doState();'> <INPUT type=button value=" State " onClick='alert("state: " + getVLC("vlc").input.state);'>
</TD><TD align="right"> </TD><TD align="right">
<SPAN style="text-align:center">Volume:</SPAN> <SPAN style="text-align:center">Volume:</SPAN>
<INPUT type=button value=" - " onClick='updateVolume(-10)'> <INPUT type=button value=" - " onClick='updateVolume(-10)'>
<SPAN id="volumeTextField" style="text-align:center">--</SPAN> <SPAN id="volumeTextField" style="text-align:center">--</SPAN>
...@@ -143,11 +150,19 @@ Insert Slider widget ...@@ -143,11 +150,19 @@ Insert Slider widget
<INPUT type=button value="Mute" onClick='getVLC("vlc").audio.toggleMute();'> <INPUT type=button value="Mute" onClick='getVLC("vlc").audio.toggleMute();'>
</TD> </TD>
</TR> </TR>
<TR><TD>Playlist: <TR><TD>Playlist:
<INPUT type=button value="Prev" onClick='getVLC("vlc").playlist.prev();'> <INPUT type=button value="Prev" onClick='getVLC("vlc").playlist.prev();'>
<INPUT type=button value="Next" onClick='getVLC("vlc").playlist.next();'> <INPUT type=button value="Next" onClick='getVLC("vlc").playlist.next();'>
<INPUT type=button value="Clear All" onClick='getVLC("vlc").playlist.clear(); doItemCount();'> <INPUT type=button value="Clear All" onClick='getVLC("vlc").playlist.clear(); doItemCount();'>
<INPUT size=4 value="1:1" id="aspect"><INPUT type=submit value="AspectRatio" onClick="doAspectRatio(document.getElementById('aspect').value);"> 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"> </TD><TD align="right">
<INPUT type=button id="itemCount" value=" Items 0 " onClick='doItemCount();'> <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);"> <INPUT size=4 value="" id="removeid"><INPUT type=submit value="Delete" onClick="doRemoveItem(document.getElementById('removeid').value);">
...@@ -187,6 +202,20 @@ Verbosity: ...@@ -187,6 +202,20 @@ Verbosity:
<INPUT type=button value="get position" onClick='doGetPosition();'> <INPUT type=button value="get position" onClick='doGetPosition();'>
</TD> </TD>
</TR> </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);'>
</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> </TABLE>
<SCRIPT language="javascript"> <SCRIPT language="javascript">
<!-- <!--
...@@ -194,128 +223,157 @@ Verbosity: ...@@ -194,128 +223,157 @@ 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 inputTrackerScrolling = false; var inputTrackerScrolling = false;
var inputTrackerIgnoreChange = false; var inputTrackerIgnoreChange = false;
var telxState = false;
function doSetSlider() function doSetSlider()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if (vlc.input) // set slider to new position
{ if( vlc )
// set slider to new position 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
{ if (vlc)
// set slider to new position alert( "position is " + vlc.input.time);
alert( "position is " + vlc.input.time); }
}
};
function doForwardPlay(speed) function doReverse(rate)
{ {
if (rateTimerId == 0) var vlc = getVLC("vlc");
{ if( vlc )
rateTimerId = setInterval("ratechange()", speed); vlc.input.rate = -1.0 * vlc.input.rate;
rate = speed; }
}
else rate = rate + speed;
};
function doBackwardPlay(speed) function doVerbosity(value)
{ {
if (rateTimerId == 0) var vlc = getVLC("vlc");
{ if( vlc )
rateTimerId = setInterval("ratechange()", speed); {
rate = -speed; vlc.log.verbosity = vlc.log.verbosity + value;
} document.getElementById("verbosity").value = vlc.log.verbosity;
else rate = rate - speed; }
}; }
function ratechange() function doAudioChannel(value)
{ {
if (rateTimerId != 0) var vlc = getVLC("vlc");
if( vlc )
vlc.audio.channel = parseInt(value);
}
function doAudioTrack(value)
{
var vlc = getVLC("vlc");
if( vlc )
{ {
var vlc = getVLC("vlc"); vlc.audio.track = vlc.audio.track + value;
vlc.input.time = vlc.input.time + rate; document.getElementById("trackTextField").innerHTML = vlc.audio.track;
} }
}; }
function doVerbosity(value) function doAspectRatio(value)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
vlc.log.verbosity = vlc.log.verbosity + value; if( vlc )
document.getElementById("verbosity").value = vlc.log.verbosity; vlc.video.aspectRatio = value;
}; }
function doAudioChannel(value) function doSubtitle(value)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
vlc.audio.channel = parseInt(value); if( vlc )
}; {
vlc.video.subtitle = vlc.video.subtitle + value;
document.getElementById("spuTextField").innerHTML = vlc.video.subtitle;
}
}
function doAudioTrack(value) function doTelxPage(value)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
vlc.audio.track = vlc.audio.track + value; if( vlc )
document.getElementById("trackTextField").innerHTML = vlc.audio.track; vlc.video.teletext = parseInt(value);
}; }
function doAspectRatio(value) function doToggleTeletext()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
vlc.video.aspectRatio = value;
document.getElementById("aspect").value = vlc.video.aspectRatio; 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() function doItemCount()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
var count = vlc.playlist.itemCount; if( vlc )
document.getElementById("itemCount").value = " Items " + count + " "; {
}; var count = vlc.playlist.itemCount;
document.getElementById("itemCount").value = " Items " + count + " ";
}
}
function doRemoveItem(item) function doRemoveItem(item)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
vlc.playlist.removeItem(item); if( vlc )
}; vlc.playlist.removeItem(item);
}
function doMessages() function doMessages()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc.log.messages.count > 0 ) if( vlc )
{ {
// there is one or more messages in the log if( vlc.log.messages.count > 0 )
var iter = vlc.log.messages.iterator();
while( iter.hasNext )
{ {
var msg = iter.next(); // there is one or more messages in the log
if( msg.severity <= 1 ) var iter = vlc.log.messages.iterator();
while( iter.hasNext )
{ {
document.getElementById("message").innerHTML = msg.message; var msg = iter.next();
if( msg.severity <= 1 )
{
document.getElementById("message").innerHTML = msg.message;
}
} }
// clear the log once finished to avoid clogging
vlc.log.messages.clear();
} }
// clear the log once finished to avoid clogging
vlc.log.messages.clear();
} }
}; }
function updateVolume(deltaVol) function updateVolume(deltaVol)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
vlc.audio.volume += deltaVol; if( vlc )
document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%"; {
}; vlc.audio.volume += deltaVol;
document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
}
}
function formatTime(timeVal) function formatTime(timeVal)
{ {
...@@ -332,16 +390,19 @@ function formatTime(timeVal) ...@@ -332,16 +390,19 @@ 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 )
{ {
// current media has stopped // current media has stopped
onEnd(); onEnd();
} }
else if( newState == 1 ) else if( newState == 1 )
...@@ -371,53 +432,48 @@ function doState() ...@@ -371,53 +432,48 @@ function doState()
} }
else if( newState == 6 ) else if( newState == 6 )
{ {
// current media is playing forward // current media has ended
onForward(); onEnd();
} }
else if( newState == 7 ) else if( newState == 7 )
{
// current media is playing backward
onBackward();
}
else if( newState == 8 )
{
// current media has ended
onEnd();
}
else if( newState == 9 )
{ {
// 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.log.messages.count > 0 ) if( vlc )
{ {
// there is one or more messages in the log newState = vlc.input.state;
var iter = vlc.log.messages.iterator();
while( iter.hasNext ) if( vlc.log.messages.count > 0 )
{ {
var msg = iter.next(); // there is one or more messages in the log
if( msg.severity == 1 ) var iter = vlc.log.messages.iterator();
while( iter.hasNext )
{ {
alert( msg.message ); var msg = iter.next();
if( msg.severity == 1 )
{
alert( msg.message );
}
document.getElementById("message").innerHTML = msg.message;
} }
document.getElementById("message").innerHTML = msg.message; // clear the log once finished to avoid clogging
vlc.log.messages.clear();
} }
// clear the log once finished to avoid clogging
vlc.log.messages.clear();
} }
if( prevState != newState ) if( prevState != newState )
{ {
if( newState == 0 ) if( newState == 0 )
{ {
// current media has stopped // current media has stopped
onEnd(); onEnd();
} }
else if( newState == 1 ) else if( newState == 1 )
...@@ -440,27 +496,17 @@ function monitor() ...@@ -440,27 +496,17 @@ function monitor()
// current media is now paused // current media is now paused
onPause(); onPause();
} }
else if( newState == 5 ) else if( newState == 5 )
{ {
// current media has stopped // current media has stopped
onStop(); onStop();
} }
else if( newState == 6 ) else if( newState == 6 )
{ {
// current media is playing forward // current media has ended
onForward();
}
else if( newState == 7 )
{
// current media is playing backward
onBackward();
}
else if( newState == 8 )
{
// current media has ended
onEnd(); onEnd();
} }
else if( newState == 9 ) else if( newState == 7 )
{ {
// current media encountered error // current media encountered error
onError(); onError();
...@@ -484,102 +530,106 @@ function doGo(targetURL) ...@@ -484,102 +530,106 @@ function doGo(targetURL)
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
vlc.playlist.clear(); if( vlc )
while( vlc.playlist.itemCount > 0 )
{
// clear() may return before the playlist has actually been cleared
// just wait for it to finish its job
}
//vlc.playlist.add(targetURL);
//vlc.playlist.play();
var itemId = vlc.playlist.add(targetURL);
if( itemId != -1 )
{ {
// clear the message log and enable error logging vlc.playlist.clear();
vlc.log.verbosity = 1; while( vlc.playlist.itemCount > 0 )
vlc.log.messages.clear();
// play MRL
vlc.playlist.play();
if( monitorTimerId == 0 )
{ {
monitor(); // clear() may return before the playlist has actually been cleared
// just wait for it to finish its job
} }
} //vlc.playlist.add(targetURL);
else //vlc.playlist.play();
{
// disable log
vlc.log.verbosity = -1;
alert("cannot play at the moment !");
}
doItemCount();
if (rateTimerId != 0) var itemId = vlc.playlist.add(targetURL);
{ if( itemId != -1 )
clearInterval("ratechange()"); {
// clear the message log and enable error logging
vlc.log.verbosity = 1;
vlc.log.messages.clear();
// play MRL
vlc.playlist.play();
if( monitorTimerId == 0 )
{
monitor();
}
}
else
{
// disable log
vlc.log.verbosity = -1;
alert("cannot play at the moment !");
}
doItemCount();
} }
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");
vlc.playlist.add(targetURL); if( vlc )
doItemCount(); {
}; vlc.playlist.add(targetURL);
doItemCount();
}
}
function doPlayOrPause() function doPlayOrPause()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
if( vlc.playlist.isPlaying ) if( vlc )
{
vlc.playlist.togglePause();
monitor();
}
else if( vlc.playlist.itemCount > 0 )
{
// clear the message log and enable error logging
vlc.log.verbosity = 1;
vlc.log.messages.clear();
vlc.playlist.play();
monitor();
}
else
{ {
// disable log if( vlc.playlist.isPlaying )
vlc.log.verbosity = -1; {
alert('nothing to play !'); vlc.playlist.togglePause();
} monitor();
if (rateTimerId != 0) }
{ else if( vlc.playlist.itemCount > 0 )
clearInterval("ratechange()"); {
// clear the message log and enable error logging
vlc.log.verbosity = 1;
vlc.log.messages.clear();
vlc.playlist.play();
monitor();
}
else
{
// disable log
vlc.log.verbosity = -1;
alert('nothing to play !');
}
} }
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");
vlc.input.rate = vlc.input.rate / 2; if( vlc )
}; vlc.input.rate = vlc.input.rate / 2;
}
function doPlayFaster() function doPlayFaster()
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
vlc.input.rate = vlc.input.rate * 2; if( vlc )
}; vlc.input.rate = vlc.input.rate * 2;
}
/* events */ /* events */
...@@ -587,142 +637,153 @@ function onOpen() ...@@ -587,142 +637,153 @@ 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;
function onPlaying() function onPlaying()
{ {
if( ! inputTrackerScrolling ) if( !inputTrackerScrolling )
{ {
var vlc = getVLC("vlc"); var vlc = getVLC("vlc");
var info = document.getElementById("info"); var info = document.getElementById("info");
var mediaLen = vlc.input.length; if( vlc )
inputTrackerIgnoreChange = true;
if( mediaLen > 0 )
{ {
// seekable media var mediaLen = vlc.input.length;
if( inputTracker.maxVal == 1.0 ) inputTrackerIgnoreChange = true;
if( mediaLen > 0 )
{ {
inputTracker.setDisabled(false); // seekable media
inputTracker.maxVal = 1.0; 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);
} }
inputTracker.setValue(vlc.input.position); else
info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(mediaLen);
}
else
{
// non-seekable "live" media
if( inputTracker.maxVal != 0.0 )
{ {
inputTracker.maxVal = 0.0; // non-seekable "live" media
inputTracker.setValue(0.0); if( inputTracker )
inputTracker.setDisabled(true); {
if( inputTracker.maxVal != 0.0 )
{
inputTracker.maxVal = 0.0;
inputTracker.setValue(0.0);
inputTracker.setDisabled(true);
}
}
liveFeedRoll = liveFeedRoll & 3;
info.innerHTML = liveFeedText[liveFeedRoll++];
} }
liveFeedRoll = liveFeedRoll & 3; inputTrackerIgnoreChange = false;
info.innerHTML = liveFeedText[liveFeedRoll++];
} }
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
vlc.log.verbosity = -1; var vlc = getVLC("vlc");
if( vlc )
vlc.log.verbosity = -1;
if( ! inputTracker.disabled ) if( inputTracker )
{ {
inputTracker.setValue(inputTracker.minVal); if( !inputTracker.disabled )
inputTracker.setDisabled(true); {
inputTracker.setValue(inputTracker.minVal);
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.log.messages.count > 0 ) if( vlc )
{ {
// there is one or more messages in the log if( vlc.log.messages.count > 0 )
var iter = vlc.log.messages.iterator();
while( iter.hasNext )
{ {
var msg = iter.next(); // there is one or more messages in the log
if( msg.severity <= 1 ) var iter = vlc.log.messages.iterator();
while( iter.hasNext )
{ {
alert( msg.message ); var msg = iter.next();
if( msg.severity <= 1 )
{
alert( msg.message );
}
document.getElementById("message").innerHTML = msg.message;
} }
document.getElementById("message").innerHTML = msg.message; // clear the log once finished to avoid clogging
vlc.log.messages.clear();
} }
// clear the log once finished to avoid clogging
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.input.state == 3) && (vlc.input.position != value) ) if( vlc )
{ {
var info = document.getElementById("info"); if( (vlc.input.state == 3) && (vlc.input.position != value) )
vlc.input.position = value; {
info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length); var info = document.getElementById("info");
vlc.input.position = value;
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