1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
3 <TITLE>VLC Plugin test page
</TITLE>
8 font-family : Arial, Helvetica, sans-serif;
13 <SCRIPT type=
"text/javascript" src=
"blueshoes-4.5/javascript/lib/LibCrossBrowser.js"></SCRIPT>
14 <SCRIPT type=
"text/javascript" src=
"blueshoes-4.5/javascript/lib/EventHandler.js"></SCRIPT>
15 <SCRIPT type=
"text/javascript" src=
"blueshoes-4.5/javascript/core/form/Bs_FormUtil.lib.js"></SCRIPT>
16 <SCRIPT type=
"text/javascript" src=
"blueshoes-4.5/javascript/components/slider/Bs_Slider.class.js"></SCRIPT>
18 <SCRIPT language=
"JavaScript"><!--
20 inputTracker = new Bs_Slider();
21 inputTracker.attachOnChange(onInputTrackerChange);
22 inputTracker.attachOnSlideStart(onInputTrackerScrollStart);
23 inputTracker.attachOnSlideEnd(onInputTrackerScrollEnd);
24 inputTracker.width = 530 ;
25 inputTracker.height = 15;
26 inputTracker.minVal = 0;
27 inputTracker.maxVal = 1.0;
28 inputTracker.valueDefault = 0;
29 inputTracker.valueInterval = 1/530;
30 inputTracker.setDisabled(true);
31 inputTracker.imgDir = 'blueshoes-4.5/javascript/components/slider/img/';
32 inputTracker.setBackgroundImage('aluminumalloyvolcanic/horizontal_background.gif', 'repeat');
33 inputTracker.setArrowIconLeft('aluminumalloyvolcanic/horizontal_backgroundLeft.gif', 2, 19);
34 inputTracker.setArrowIconRight('aluminumalloyvolcanic/horizontal_backgroundRight.gif', 2, 19);
35 inputTracker.setSliderIcon('aluminumalloyvolcanic/horizontal_knob.gif', 15, 19);
36 inputTracker.useInputField = 0;
37 inputTracker.draw('inputTrackerDiv');
39 if( navigator.appName.indexOf("Microsoft Internet")==-1 )
43 else if( document.readyState == 'complete' )
49 /* Explorer loads plugins asynchronously */
50 document.onreadystatechange=function() {
51 if( document.readyState == 'complete' )
61 if (window.document[name])
63 return window.document[name];
65 if (navigator.appName.indexOf("Microsoft Internet")==-1)
67 if (document.embeds && document.embeds[name])
68 return document.embeds[name];
70 else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
72 return document.getElementById(name);
76 function onVLCPluginReady()
83 <BODY onLoad=
"init();">
87 <INPUT size=
"90" id=
"targetTextField" value=
"">
88 <INPUT type=submit
value=
"Go" onClick=
"doGo(document.getElementById('targetTextField').value);">
89 <INPUT type=submit
value=
"Add" onClick=
"doAdd(document.getElementById('targetTextField').value);">
91 <TR><TD align=
"center" colspan=
"2">
93 Insert VideoLAN.VLCPlugin.2
95 <OBJECT classid=
"clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
100 <param name=
"MRL" value=
"" />
101 <param name=
"ShowDisplay" value=
"True" />
102 <param name=
"AutoLoop" value=
"False" />
103 <param name=
"AutoPlay" value=
"False" />
104 <param name=
"Volume" value=
"50" />
105 <param name=
"toolbar" value=
"true" />
106 <param name=
"StartTime" value=
"0" />
107 <EMBED pluginspage=
"http://www.videolan.org"
108 type=
"application/x-vlc-plugin"
109 version=
"VideoLAN.VLCPlugin.2"
119 <TD valign=
"top" width=
"550">
123 <DIV id=
"inputTrackerDiv"</DIV>
124 </TD><TD width=
"15%">
125 <DIV id=
"info" style=
"text-align:center">-:--:--/-:--:--
</DIV>
126 <DIV id=
"state" style=
"text-align:center">Stopped...
</DIV>
130 <INPUT type=button
id=
"PlayOrPause" value=
" Play " onClick='doPlayOrPause();'
>
131 <INPUT type=button
value=
"Stop" onClick='doStop();'
>
133 <INPUT type=button
value=
" << " onClick='doPlaySlower();'
>
134 <INPUT type=button
value=
" >> " onClick='doPlayFaster();'
>
135 <INPUT type=button
value=
"Backward" onClick='doBackwardPlay(
500);'
>
136 <INPUT type=button
value=
"Forward" onClick='doForwardPlay(
500);'
>
137 <INPUT type=button
value=
"Fullscreen" onClick='getVLC(
"vlc").video.toggleFullscreen();'
>
138 <INPUT type=button
value=
"Version" onClick='alert(
"vlc " + getVLC(
"vlc").VersionInfo);'
>
139 <INPUT type=button
value=
" State " onClick='doState();'
>
140 </TD><TD align=
"right">
141 <SPAN style=
"text-align:center">Volume:
</SPAN>
142 <INPUT type=button
value=
" - " onClick='updateVolume(-
10)'
>
143 <SPAN id=
"volumeTextField" style=
"text-align:center">--
</SPAN>
144 <INPUT type=button
value=
" + " onClick='updateVolume(+
10)'
>
145 <INPUT type=button
value=
"Mute" onClick='getVLC(
"vlc").audio.toggleMute();'
>
149 <INPUT type=button
value=
"Prev" onClick='getVLC(
"vlc").playlist.prev();'
>
150 <INPUT type=button
value=
"Next" onClick='getVLC(
"vlc").playlist.next();'
>
151 <INPUT type=button
value=
"Clear All" onClick='getVLC(
"vlc").playlist.clear(); doItemCount();'
>
153 <SELECT readonly onChange='doAspectRatio(this.value)'
>
154 <OPTION value=
"default">Default
</OPTION>
155 <OPTION value=
"1:1">1:
1</OPTION>
156 <OPTION value=
"4:3">4:
3</OPTION>
157 <OPTION value=
"16:9">16:
9</OPTION>
158 <OPTION value=
"221:100">221:
100</OPTION>
159 <OPTION value=
"5:4">5:
4</OPTION>
161 </TD><TD align=
"right">
162 <INPUT type=button
id=
"itemCount" value=
" Items 0 " onClick='doItemCount();'
>
163 <INPUT size=
4 value=
"" id=
"removeid"><INPUT type=submit
value=
"Delete" onClick=
"doRemoveItem(document.getElementById('removeid').value);">
167 <INPUT type=button
value=
"Messages" onClick='doMessages();'
>
169 <INPUT size=
2 value=
"1" id=
"verbosity" onClick=
"doVerbosity(document.getElementById('verbosity').value);">
170 <INPUT type=button
value=
" + " onClick='doVerbosity(
1);'
>
171 <INPUT type=button
value=
" - " onClick='doVerbosity(-
1);'
>
174 <DIV id=
"message" style=
"text-align:center">no message
</DIV>
177 <TR><TD>Audio Channel:
178 <SELECT readonly onClick='doAudioChannel(this.value);'
>
179 <OPTION value=
1>Stereo
</OPTION>
180 <OPTION value=
2>Reverse Stereo
</OPTION>
181 <OPTION value=
3>Left
</OPTION>
182 <OPTION value=
4>Right
</OPTION>
183 <OPTION value=
5>Dolby
</OPTION>
187 <INPUT type=button
value=
"current channel" onClick='alert(getVLC(
"vlc").audio.channel);'
>
190 <TR><TD> Audio Track:
191 <INPUT type=button
value=
" + " onClick='doAudioTrack(
1);'
>
192 <SPAN id=
"trackTextField" style=
"text-align:center">--
</SPAN>
193 <INPUT type=button
value=
" - " onClick='doAudioTrack(-
1);'
>
196 <INPUT type=button
value=
"set slider" onClick='doSetSlider();'
>
197 <INPUT type=button
value=
"get position" onClick='doGetPosition();'
>
202 <INPUT type=button
value=
" + " onClick='doSubtitle(
1);'
>
203 <SPAN id=
"spuTextField" style=
"text-align:center">--
</SPAN>
204 <INPUT type=button
value=
" - " onClick='doSubtitle(-
1);'
>
209 <INPUT type=button
id=
"telx" value=
"Teletext off" onClick='doToggleTeletext();'
>
211 <INPUT size=
4 value=
"100" id=
"telxPage" onClick='doTelxPage(document.getElementById(
"telxPage").value);'
>
215 <SCRIPT language=
"javascript">
220 var monitorTimerId = 0;
222 var inputTrackerScrolling = false;
223 var inputTrackerIgnoreChange = false;
224 var telxState = false;
226 function doSetSlider()
228 var vlc = getVLC("vlc");
232 // set slider to new position
233 vlc.input.time = (vlc.input.length/2);
237 function doGetPosition()
239 var vlc = getVLC("vlc");
243 // set slider to new position
244 alert( "position is " + vlc.input.time);
248 function doForwardPlay(speed)
250 if (rateTimerId == 0)
252 rateTimerId = setInterval("ratechange()", speed);
255 else rate = rate + speed;
258 function doBackwardPlay(speed)
260 if (rateTimerId == 0)
262 rateTimerId = setInterval("ratechange()", speed);
265 else rate = rate - speed;
268 function ratechange()
270 if (rateTimerId != 0)
272 var vlc = getVLC("vlc");
273 vlc.input.time = vlc.input.time + rate;
277 function doVerbosity(value)
279 var vlc = getVLC("vlc");
280 vlc.log.verbosity = vlc.log.verbosity + value;
281 document.getElementById("verbosity").value = vlc.log.verbosity;
284 function doAudioChannel(value)
286 var vlc = getVLC("vlc");
287 vlc.audio.channel = parseInt(value);
290 function doAudioTrack(value)
292 var vlc = getVLC("vlc");
293 vlc.audio.track = vlc.audio.track + value;
294 document.getElementById("trackTextField").innerHTML = vlc.audio.track;
297 function doAspectRatio(value)
299 var vlc = getVLC("vlc");
300 vlc.video.aspectRatio = value;
303 function doSubtitle(value)
305 var vlc = getVLC("vlc");
306 vlc.video.subtitle = vlc.video.subtitle + value;
307 document.getElementById("spuTextField").innerHTML = vlc.video.subtitle;
310 function doTelxPage(value)
312 var vlc = getVLC("vlc");
313 vlc.video.teletext = parseInt(value);
316 function doToggleTeletext()
318 var vlc = getVLC("vlc");
320 vlc.video.toggleTeletext();
323 document.getElementById("telx").innerHTML = "Teletext on";
328 document.getElementById("telx").innerHTML = "Teletext off";
333 function doItemCount()
335 var vlc = getVLC("vlc");
336 var count = vlc.playlist.itemCount;
337 document.getElementById("itemCount").value = " Items " + count + " ";
340 function doRemoveItem(item)
342 var vlc = getVLC("vlc");
343 vlc.playlist.removeItem(item);
346 function doMessages()
348 var vlc = getVLC("vlc");
350 if( vlc.log.messages.count > 0 )
352 // there is one or more messages in the log
353 var iter = vlc.log.messages.iterator();
354 while( iter.hasNext )
356 var msg = iter.next();
357 if( msg.severity <= 1 )
359 document.getElementById("message").innerHTML = msg.message;
362 // clear the log once finished to avoid clogging
363 vlc.log.messages.clear();
367 function updateVolume(deltaVol)
369 var vlc = getVLC("vlc");
370 vlc.audio.volume += deltaVol;
371 document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
374 function formatTime(timeVal)
376 var timeHour = Math.round(timeVal / 1000);
377 var timeSec = timeHour % 60;
379 timeSec = '0'+timeSec;
380 timeHour = (timeHour - timeSec)/60;
381 var timeMin = timeHour % 60;
383 timeMin = '0'+timeMin;
384 timeHour = (timeHour - timeMin)/60;
386 return timeHour+":"+timeMin+":"+timeSec;
388 return timeMin+":"+timeSec;
393 var vlc = getVLC("vlc");
394 var newState = vlc.input.state;
398 // current media has stopped
401 else if( newState == 1 )
403 // current media is openning/connecting
406 else if( newState == 2 )
408 // current media is buffering data
411 else if( newState == 3 )
413 // current media is now playing
416 else if( newState == 4 )
418 // current media is now paused
421 else if( newState == 5 )
423 // current media has stopped
426 else if( newState == 6 )
428 // current media is playing forward
431 else if( newState == 7 )
433 // current media is playing backward
436 else if( newState == 8 )
438 // current media has ended
441 else if( newState == 9 )
443 // current media encountered error
450 var vlc = getVLC("vlc");
451 var newState = vlc.input.state;
453 if( vlc.log.messages.count > 0 )
455 // there is one or more messages in the log
456 var iter = vlc.log.messages.iterator();
457 while( iter.hasNext )
459 var msg = iter.next();
460 if( msg.severity == 1 )
462 alert( msg.message );
464 document.getElementById("message").innerHTML = msg.message;
466 // clear the log once finished to avoid clogging
467 vlc.log.messages.clear();
470 if( prevState != newState )
474 // current media has stopped
477 else if( newState == 1 )
479 // current media is openning/connecting
482 else if( newState == 2 )
484 // current media is buffering data
487 else if( newState == 3 )
489 // current media is now playing
492 else if( newState == 4 )
494 // current media is now paused
497 else if( newState == 5 )
499 // current media has stopped
502 else if( newState == 6 )
504 // current media is playing forward
507 else if( newState == 7 )
509 // current media is playing backward
512 else if( newState == 8 )
514 // current media has ended
517 else if( newState == 9 )
519 // current media encountered error
522 prevState = newState;
524 else if( newState == 3 )
526 // current media is playing
529 if( monitorTimerId == 0 )
531 monitorTimerId = setInterval("monitor()", 1000);
537 function doGo(targetURL)
539 var vlc = getVLC("vlc");
541 vlc.playlist.clear();
542 while( vlc.playlist.itemCount > 0 )
544 // clear() may return before the playlist has actually been cleared
545 // just wait for it to finish its job
547 //vlc.playlist.add(targetURL);
548 //vlc.playlist.play();
550 var itemId = vlc.playlist.add(targetURL);
553 // clear the message log and enable error logging
554 vlc.log.verbosity = 1;
555 vlc.log.messages.clear();
558 if( monitorTimerId == 0 )
566 vlc.log.verbosity = -1;
567 alert("cannot play at the moment !");
571 if (rateTimerId != 0)
573 clearInterval("ratechange()");
578 function doAdd(targetURL)
580 var vlc = getVLC("vlc");
581 var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
582 vlc.playlist.add(targetURL);
586 function doPlayOrPause()
588 var vlc = getVLC("vlc");
589 if( vlc.playlist.isPlaying )
591 vlc.playlist.togglePause();
594 else if( vlc.playlist.itemCount > 0 )
596 // clear the message log and enable error logging
597 vlc.log.verbosity = 1;
598 vlc.log.messages.clear();
605 vlc.log.verbosity = -1;
606 alert('nothing to play !');
608 if (rateTimerId != 0)
610 clearInterval("ratechange()");
617 getVLC("vlc").playlist.stop();
618 if( monitorTimerId != 0 )
620 clearInterval(monitorTimerId);
626 function doPlaySlower()
628 var vlc = getVLC("vlc");
629 vlc.input.rate = vlc.input.rate / 2;
632 function doPlayFaster()
634 var vlc = getVLC("vlc");
635 vlc.input.rate = vlc.input.rate * 2;
642 document.getElementById("state").innerHTML = "Opening...";
643 document.getElementById("PlayOrPause").value = "Pause";
648 document.getElementById("state").innerHTML = "Buffering...";
649 document.getElementById("PlayOrPause").value = "Pause";
654 document.getElementById("state").innerHTML = "Playing...";
655 document.getElementById("PlayOrPause").value = "Pause";
660 { // Event is reserved for future enhancements
661 document.getElementById("state").innerHTML = "Forward playing...";
664 function onBackward()
665 { // Event is reserved for future enhancements
666 document.getElementById("state").innerHTML = "Backward playing...";
671 document.getElementById("state").innerHTML = "End...";
675 var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "(( Live ))");
676 var liveFeedRoll = 0;
680 if( ! inputTrackerScrolling )
682 var vlc = getVLC("vlc");
683 var info = document.getElementById("info");
684 var mediaLen = vlc.input.length;
685 inputTrackerIgnoreChange = true;
689 if( inputTracker.maxVal == 1.0 )
691 inputTracker.setDisabled(false);
692 inputTracker.maxVal = 1.0;
694 inputTracker.setValue(vlc.input.position);
695 info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(mediaLen);
699 // non-seekable "live" media
700 if( inputTracker.maxVal != 0.0 )
702 inputTracker.maxVal = 0.0;
703 inputTracker.setValue(0.0);
704 inputTracker.setDisabled(true);
706 liveFeedRoll = liveFeedRoll & 3;
707 info.innerHTML = liveFeedText[liveFeedRoll++];
709 inputTrackerIgnoreChange = false;
715 document.getElementById("state").innerHTML = "Paused...";
716 document.getElementById("PlayOrPause").value = " Play ";
722 vlc.log.verbosity = -1;
724 if( !inputTracker.disabled )
726 inputTracker.setValue(inputTracker.minVal);
727 inputTracker.setDisabled(true);
729 document.getElementById("info").innerHTML = "-:--:--/-:--:--";
730 document.getElementById("state").innerHTML = "Stopped...";
731 document.getElementById("PlayOrPause").value = " Play ";
736 var vlc = getVLC("vlc");
738 document.getElementById("state").innerHTML = "Error...";
739 if( vlc.log.messages.count > 0 )
741 // there is one or more messages in the log
742 var iter = vlc.log.messages.iterator();
743 while( iter.hasNext )
745 var msg = iter.next();
746 if( msg.severity <= 1 )
748 alert( msg.message );
750 document.getElementById("message").innerHTML = msg.message;
752 // clear the log once finished to avoid clogging
753 vlc.log.messages.clear();
757 function onInputTrackerScrollStart()
759 inputTrackerScrolling = true;
762 function onInputTrackerScrollEnd(inputTracker, value, pos)
764 inputTrackerScrolling = false;
767 function onInputTrackerChange(inputTracker, value, pos)
769 if( ! inputTrackerIgnoreChange )
771 var vlc = getVLC("vlc");
772 if( (vlc.input.state == 3) && (vlc.input.position != value) )
774 var info = document.getElementById("info");
775 vlc.input.position = value;
776 info.innerHTML = formatTime(vlc.input.time)+"/"+formatTime(vlc.input.length);