]> git.sesse.net Git - vlc/blob - activex/test.html
Also control plugin export table
[vlc] / activex / test.html
1 <HTML>
2 <TITLE>VLC ActiveX plugin test page</TITLE>
3 <BODY>
4 <TABLE>
5 <TR><TD colspan="2">
6 MRL:
7 <INPUT size="90" name="targetTextField" value="">
8 <INPUT type=submit value="Go" onClick="doGo(targetTextField.value);">
9 </TD></TR>
10 <TR><TD colspan="2">
11 <!--
12 Insert VideoLAN.VLCPlugin.1 activex control
13 -->
14 <OBJECT classid="clsid:E23FE9C6-778E-49D4-B537-38FCDE4887D8"
15         codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab#Version=0,8,4,0"
16         width="640"
17         height="480"
18         id="vlc"
19         events="True">
20 <param name="MRL" value="" />
21 <param name="ShowDisplay" value="True" />
22 <param name="AutoLoop" value="False" />
23 <param name="AutoPlay" value="False" />
24 <param name="Volume" value="50" />
25 <param name="StartTime" value="0" />
26 </OBJECT>
27 </TD></TR>
28 <TR><TD>
29 <!--
30 Insert MSComctlLib.Slider.2 activex control
31 -->
32 <OBJECT classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628"
33         width="540"
34         height="20"
35         id="slider"
36         events="True">
37 <param name="TickStyle" value="3" />
38 <param name="Min" value="0" />
39 <param name="Max" value="0" />
40 <param name="Value" value="0" />
41 <param name="Enabled" value="False" />
42 </OBJECT>
43 </TD><TD width="15%">
44 <DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
45 </TD></TR>
46 <TR><TD colspan="2">
47 <INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause()'>
48 <INPUT type=button value="Stop" onClick='document.vlc.stop();'>
49 &nbsp;
50 <INPUT type=button value=" << " onClick='document.vlc.playSlower();'>
51 <INPUT type=button value=" >> " onClick='document.vlc.playFaster();'>
52 &nbsp;
53 <INPUT type=button value="Show" onClick='document.vlc.Visible = true;'>
54 <INPUT type=button value="Hide" onClick='document.vlc.Visible = false;'>
55 &nbsp;
56 <INPUT type=button value="Version" onClick='alert(document.vlc.VersionInfo);'>
57 <SPAN style="text-align:center">Volume:</SPAN>
58 <INPUT type=button value=" - " onClick='updateVolume(-10)'>
59 <SPAN id="volumeTextField" style="text-align: center">--</SPAN>
60 <INPUT type=button value=" + " onClick='updateVolume(+10)'>
61 <INPUT type=button value="Mute" onClick='document.vlc.toggleMute();'>
62 </TD>
63 </TR>
64 </TABLE>
65 <SCRIPT LANGUAGE="JScript">
66 <!--
67 var sliderTimerId = 0;
68 var sliderScrolling = false;
69
70 document.onreadystatechange=onVLCStateChange;
71 function onVLCStateChange()
72 {
73     if( document.readyState == 'complete' )
74     {
75         updateVolume(0);
76     }
77 };
78 function updateVolume(deltaVol)
79 {
80     vlc.Volume += deltaVol;
81     volumeTextField.innerText = vlc.Volume+"%";
82 };
83 function formatTime(timeVal)
84 {
85     var timeHour = timeVal;
86     var timeSec = timeHour % 60;
87     if( timeSec < 10 )
88         timeSec = '0'+timeSec;
89     timeHour = (timeHour - timeSec)/60;
90     var timeMin = timeHour % 60;
91     if( timeMin < 10 )
92         timeMin = '0'+timeMin;
93     timeHour = (timeHour - timeMin)/60;
94     if( timeHour > 0 )
95         return timeHour+":"+timeMin+":"+timeSec;
96     else
97         return timeMin+":"+timeSec;
98 };
99 function onPlay()
100 {
101     document.getElementById("PlayOrPause").value = "Pause";
102 };
103 function onPause()
104 {
105     document.getElementById("PlayOrPause").value = " Play ";
106 };
107 function onStop()
108 {
109     if( slider.Enabled )
110     {
111         slider.Value = slider.Min;
112         slider.Enabled = false;
113     }
114     info.innerText = "-:--:--/-:--:--";
115     document.getElementById("PlayOrPause").value = " Play ";
116 };
117 var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "((  Live  ))");
118 var liveFeedRoll = 0;
119
120 function doUpdate()
121 {
122     if( vlc.Playing )
123     {
124         if( ! sliderScrolling )
125         {
126             if( vlc.Length > 0 )
127             {
128                 // seekable stream
129                 slider.Enabled = true;
130                 slider.Max = vlc.Length;
131                 slider.Value = vlc.Time;
132                 info.innerText = formatTime(vlc.Time)+"/"+formatTime(vlc.Length);
133                 document.getElementById("PlayOrPause").Enabled = true;
134             }
135             else {
136                 // non-seekable "live" stream
137                 if( slider.Enabled )
138                 {
139                     slider.Value = slider.Min;
140                     slider.Enabled = false;
141                 }
142                 liveFeedRoll = liveFeedRoll & 3;
143                 info.innerText = liveFeedText[liveFeedRoll++];
144             }
145         }
146         sliderTimerId = setTimeout("doUpdate()", 1000);
147     }
148     else
149     {
150         onStop();
151         sliderTimerId = 0;
152     }
153 };
154 function doGo(targetURL)
155 {
156         var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
157         document.vlc.addTarget(targetURL, options, 4+8, -666);
158 };
159 function doPlayOrPause()
160 {
161     if( document.vlc.playing )
162     {
163         document.vlc.pause();
164     }
165     else
166     {
167         document.vlc.play();
168     }
169 };
170 function vlc::Play()
171 {
172     if( ! sliderTimerId )
173     {
174         sliderTimerId = setTimeout("doUpdate()", 1000);
175     }
176     onPlay();
177 };
178 function vlc::Pause()
179 {
180     if( sliderTimerId )
181     {
182         clearTimeout(sliderTimerId)
183         sliderTimerId = 0;
184     }
185     onPause();
186 };
187 function vlc::Stop()
188 {
189     if( sliderTimerId )
190     {
191         clearTimeout(sliderTimerId)
192         sliderTimerId = 0;
193     }
194     onStop();
195 };
196 function slider::Scroll()
197 {
198     slider.Text = formatTime(slider.Value);
199     info.innerText = slider.Text+"/"+formatTime(vlc.Length);
200     if( vlc.Time != slider.Value )
201     {
202         vlc.Time = slider.Value;
203     }
204 };
205 function slider::Change()
206 {
207     if( sliderScrolling )
208     {
209         sliderScrolling = false;
210     }
211     else if( vlc.Time != slider.Value )
212     {
213         vlc.Time = slider.Value;
214     }
215 };
216 //-->
217 </SCRIPT>
218 </BODY>
219 </HTML>