]> git.sesse.net Git - vlc/blob - activex/test.html
A few adds to fr translation
[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" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"
15         width="640" height="480" id="vlc" events="True">
16 <param name="MRL" value="" />
17 <param name="ShowDisplay" value="True" />
18 <param name="AutoLoop" value="False" />
19 <param name="AutoPlay" value="False" />
20 </OBJECT>
21 </TD></TR>
22 <TR><TD>
23 <!--
24 Insert MSComctlLib.Slider.2 activex control
25 -->
26 <OBJECT classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628"
27         width="540" height="20" id="slider" events="True">
28 <param name="TickStyle" value="3" />
29 <param name="Min" value="0" />
30 <param name="Max" value="0" />
31 <param name="Value" value="0" />
32 <param name="Enabled" value="False" />
33 </OBJECT>
34 </TD><TD width="15%">
35 <DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
36 </TD></TR>
37 <TR><TD colspan="2">
38 <INPUT type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause()'>
39 <INPUT type=button value="Stop" onClick='document.vlc.stop();'>
40 <INPUT type=button value=" << " onClick='document.vlc.playSlower();'>
41 <INPUT type=button value=" >> " onClick='document.vlc.playFaster();'>
42 <INPUT type=button value="Mute" onClick='document.vlc.toggleMute();'>
43 <INPUT type=button value="Show" onClick='document.vlc.Visible = true;'>
44 <INPUT type=button value="Hide" onClick='document.vlc.Visible = false;'>
45 <INPUT type=button value="Version" onClick='alert(document.vlc.VersionInfo);'>
46 </TD></TR>
47 </TABLE>
48 <SCRIPT LANGUAGE="JScript">
49 <!--
50 var sliderTimerId = 0;
51 var sliderScrolling = false;
52
53 function formatTime(timeVal)
54 {
55     var timeHour = timeVal;
56     var timeSec = timeHour % 60;
57     if( timeSec < 10 )
58         timeSec = '0'+timeSec;
59     timeHour = (timeHour - timeSec)/60;
60     var timeMin = timeHour % 60;
61     if( timeMin < 10 )
62         timeMin = '0'+timeMin;
63     timeHour = (timeHour - timeMin)/60;
64     if( timeHour > 0 )
65         return timeHour+":"+timeMin+":"+timeSec;
66     else
67         return timeMin+":"+timeSec;
68 };
69 function onPlay()
70 {
71     document.getElementById("PlayOrPause").value = "Pause";
72 };
73 function onPause()
74 {
75     document.getElementById("PlayOrPause").value = " Play ";
76 };
77 function onStop()
78 {
79     if( slider.Enabled )
80     {
81         slider.Value = slider.Min;
82         slider.Enabled = false;
83     }
84     info.innerText = "-:--:--/-:--:--";
85     document.getElementById("PlayOrPause").value = " Play ";
86 };
87 var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "((  Live  ))");
88 var liveFeedRoll = 0;
89
90 function doUpdate()
91 {
92     if( vlc.Playing )
93     {
94         if( ! sliderScrolling )
95         {
96             if( vlc.Length > 0 )
97             {
98                 // seekable stream
99                 slider.Enabled = true;
100                 slider.Max = vlc.Length;
101                 slider.Value = vlc.Time;
102                 info.innerText = formatTime(vlc.Time)+"/"+formatTime(vlc.Length);
103                 document.getElementById("PlayOrPause").Enabled = true;
104             }
105             else {
106                 // non-seekable "live" stream
107                 if( slider.Enabled )
108                 {
109                     slider.Value = slider.Min;
110                     slider.Enabled = false;
111                 }
112                 liveFeedRoll = liveFeedRoll & 3;
113                 info.innerText = liveFeedText[liveFeedRoll++];
114             }
115         }
116         sliderTimerId = setTimeout("doUpdate()", 1000);
117     }
118     else
119     {
120         onStop();
121         sliderTimerId = 0;
122     }
123 };
124 function doGo(targetURL)
125 {
126         var options = new Array(":input-repeat=0");
127         document.vlc.addTarget(targetURL, options, 4+8, -666);
128 };
129 function doPlayOrPause()
130 {
131     if( document.vlc.playing )
132     {
133         document.vlc.pause();
134     }
135     else
136     {
137         document.vlc.play();
138     }
139 };
140 function vlc::Play()
141 {
142     if( ! sliderTimerId )
143     {
144         sliderTimerId = setTimeout("doUpdate()", 1000);
145     }
146     onPlay();
147 };
148 function vlc::Pause()
149 {
150     if( sliderTimerId )
151     {
152         clearTimeout(sliderTimerId)
153         sliderTimerId = 0;
154     }
155     onPause();
156 };
157 function vlc::Stop()
158 {
159     if( sliderTimerId )
160     {
161         clearTimeout(sliderTimerId)
162         sliderTimerId = 0;
163     }
164     onStop();
165 };
166 function slider::Scroll()
167 {
168     slider.Text = formatTime(slider.Value);
169     info.innerText = slider.Text+"/"+formatTime(vlc.Length);
170     if( vlc.Time != slider.Value )
171     {
172         vlc.Time = slider.Value;
173     }
174 };
175 function slider::Change()
176 {
177     if( sliderScrolling )
178     {
179         sliderScrolling = false;
180     }
181     else if( vlc.Time != slider.Value )
182     {
183         vlc.Time = slider.Value;
184     }
185 };
186 //-->
187 </SCRIPT>
188 </BODY>
189 </HTML>