]> git.sesse.net Git - vlc/blob - projects/mozilla/test.html
66bc3e9598b9a2d7eefb09af8564751324ed434d
[vlc] / projects / mozilla / test.html
1 <HTML>
2 <TITLE>VLC Mozilla plug-in test page</TITLE>
3 <BODY>
4 <TABLE>
5 <TR><TD colspan="2">
6 MRL:
7 <INPUT size="90" id="targetTextField" value="">
8 <INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">
9 </TD></TR>
10 <TR><TD colspan="2">
11 <EMBED  type="application/x-vlc-plugin" pluginspage="http://www.videolan.org/" version="VideoLAN.VLCPlugin.2"
12         width="640"
13         height="480"
14         id="vlc">
15 </EMBED>
16 </TD></TR>
17 <TR><TD>
18 <INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause()'>
19 <INPUT type=button value="Stop" onClick='document.getElementById("vlc").playlist.stop();'>
20 &nbsp;
21 <INPUT type=button value=" << " onClick='doPlaySlower();'>
22 <INPUT type=button value=" >> " onClick='doPlayFaster();'>
23 &nbsp;
24 <INPUT type=button value="Version" onClick='alert(document.getElementById("vlc"));'>
25 <SPAN style="text-align:center">Volume:</SPAN>
26 <INPUT type=button value=" - " onClick='updateVolume(-10)'>
27 <SPAN id="volumeTextField" style="text-align: center">--</SPAN>
28 <INPUT type=button value=" + " onClick='updateVolume(+10)'>
29 <INPUT type=button value="Mute" onClick='document.getElementById("vlc").audio.toggleMute();'>
30 </TD><TD width="15%">
31 <DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
32 </TD></TR>
33 </TABLE>
34 <SCRIPT LANGUAGE="Javascript">
35 <!--
36 var timerId = 0;
37
38 function updateVolume(deltaVol)
39 {
40     var vlc = document.getElementById("vlc");
41     vlc.audio.volume += deltaVol;
42     document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
43 };
44 function formatTime(timeVal)
45 {
46     var timeHour = timeVal;
47     var timeSec = timeHour % 60;
48     if( timeSec < 10 )
49         timeSec = '0'+timeSec;
50     timeHour = (timeHour - timeSec)/60;
51     var timeMin = timeHour % 60;
52     if( timeMin < 10 )
53         timeMin = '0'+timeMin;
54     timeHour = (timeHour - timeMin)/60;
55     if( timeHour > 0 )
56         return timeHour+":"+timeMin+":"+timeSec;
57     else
58         return timeMin+":"+timeSec;
59 };
60 function onPlay()
61 {
62     document.getElementById("PlayOrPause").value = "Pause";
63 };
64 function onPause()
65 {
66     document.getElementById("PlayOrPause").value = " Play ";
67 };
68 function onStop()
69 {
70     document.getElementById("info").innerHTML = "-:--:--/-:--:--";
71     document.getElementById("PlayOrPause").value = " Play ";
72 };
73 var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "((  Live  ))");
74 var liveFeedRoll = 0;
75
76 function doUpdate()
77 {
78     var vlc = document.getElementById("vlc");
79     if( vlc.playlist.isPlaying )
80     {
81         if( vlc.input.length > 0 )
82         {
83             // seekable stream
84             document.getElementById("info").innerHTML = formatTime(vlc.input.time/1000)+"/"+formatTime(vlc.input.length/1000);
85             document.getElementById("PlayOrPause").Enabled = true;
86         }
87         else {
88             liveFeedRoll = liveFeedRoll & 3;
89             document.getElementById("info").innerText = liveFeedText[liveFeedRoll++];
90         }
91         timerId = setTimeout("doUpdate()", 1000);
92     }
93     else
94     {
95         onStop();
96         timerId = 0;
97     }
98 };
99 function doGo(targetURL)
100 {
101         var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
102         document.getElementById("vlc").playlist.add(targetURL, null, options);
103 };
104 function doPlayOrPause()
105 {
106     var vlc = document.getElementById("vlc");
107     if( vlc.playlist.isPlaying )
108     {
109         vlc.playlist.pause();
110     }
111     else
112     {
113         vlc.playlist.play();
114     }
115 };
116 function doPlaySlower()
117 {
118     var vlc = document.getElementById("vlc");
119     vlc.input.rate = vlc.input.rate / 2;
120 };
121 function doPlayFaster()
122 {
123     var vlc = document.getElementById("vlc");
124     vlc.input.rate = vlc.input.rate * 2;
125 };
126 function vlcPlayEvent()
127 {
128     if( ! timerId )
129     {
130         timerId = setTimeout("doUpdate()", 1000);
131     }
132     onPlay();
133 };
134 function vlcPauseEvent()
135 {
136     if( timerId )
137     {
138         clearTimeout(timerId)
139         timerId = 0;
140     }
141     onPause();
142 };
143 function vlcStopEvent()
144 {
145     if( timerId )
146     {
147         clearTimeout(timerId)
148         timerId = 0;
149     }
150     onStop();
151 };
152 //-->
153 </SCRIPT>
154 </BODY>
155 </HTML>