Commit 12396c6a authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

New Windowless page for testing

parent 3e3894e1
......@@ -248,7 +248,6 @@ Insert VideoLAN.VLCPlugin.2
width="640"
height="480"
id="vlc"
windowless="True"
events="True">
<param name="MRL" value="" />
<param name="ShowDisplay" value="True" />
......@@ -265,7 +264,6 @@ Insert VideoLAN.VLCPlugin.2
toolbar="true"
loop="true"
text="Waiting for video"
windowless="true"
name="vlc">
</EMBED>
</object>
......@@ -401,12 +399,6 @@ Insert Slider widget
<input size=4 value="100" id="telxPage" onClick='doTelxPage(document.getElementById("telxPage").value);'>
</td>
</tr>
<tr>
<td>
<input type=button value="3D transform" onClick='doToggle3dTransform();'>
(windowless only)
</td>
</tr>
</table>
<SCRIPT language="javascript">
<!--
......@@ -513,26 +505,6 @@ function doToggleTeletext()
}
}
function doToggle3dTransform()
{
var vlc = getVLC("vlc");
var transform = "rotate3d(1,2,1, 45deg)";
if( vlc )
{
if (!vlc.style.transform)
{
vlc.style.transform = transform;
vlc.style.webkitTransform = transform;
}
else
{
vlc.style.transform = '';
vlc.style.webkitTransform = '';
}
}
}
function doItemCount()
{
var vlc = getVLC("vlc");
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<title>VLC Plugin test page</TITLE>
<style>
.inputTrackerInput {
height:20;
width:30;
font-family : Arial, Helvetica, sans-serif;
font-size : 12px;
}
body {background: grey;}
</style>
<script language="JavaScript"><!--
function init()
{
if( navigator.appName.indexOf("Microsoft Internet")==-1 )
{
onVLCPluginReady()
}
else if( document.readyState == 'complete' )
{
onVLCPluginReady();
}
else
{
/* Explorer loads plugins asynchronously */
document.onreadystatechange=function()
{
if( document.readyState == 'complete' )
{
onVLCPluginReady();
}
}
}
}
function getVLC(name)
{
if (window.document[name])
{
return window.document[name];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds[name])
return document.embeds[name];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById(name);
}
}
function registerVLCEvent(event, handler)
{
var vlc = getVLC("vlc");
if (vlc) {
if (vlc.attachEvent) {
// Microsoft
vlc.attachEvent (event, handler);
} else if (vlc.addEventListener) {
// Mozilla: DOM level 2
vlc.addEventListener (event, handler, true);
} else {
// DOM level 0
eval("vlc.on" + event + " = handler");
}
}
}
function unregisterVLCEvent(event, handler)
{
var vlc = getVLC("vlc");
if (vlc) {
if (vlc.detachEvent) {
// Microsoft
vlc.detachEvent (event, handler);
} else if (vlc.removeEventListener) {
// Mozilla: DOM level 2
vlc.removeEventListener (event, handler, true);
} else {
// DOM level 0
eval("vlc.on" + event + " = null");
}
}
}
// JS VLC API callbacks
function handleMediaPlayerMediaChanged()
{
document.getElementById("info").innerHTML = "Media Changed";
}
function handle_MediaPlayerNothingSpecial()
{
document.getElementById("state").innerHTML = "Idle...";
}
function handle_MediaPlayerOpening()
{
onOpen();
}
function handle_MediaPlayerBuffering(val)
{
document.getElementById("info").innerHTML = val + "%";
}
function handle_MediaPlayerPlaying()
{
onPlay();
}
function handle_MediaPlayerPaused()
{
onPause();
}
function handle_MediaPlayerStopped()
{
onStop();
}
function handle_MediaPlayerForward()
{
document.getElementById("state").innerHTML = "Forward...";
}
function handle_MediaPlayerBackward()
{
document.getElementById("state").innerHTML = "Backward...";
}
function handle_MediaPlayerEndReached()
{
onEnd();
}
function handle_MediaPlayerEncounteredError()
{
onError();
}
function handle_MediaPlayerTimeChanged(time)
{
var vlc = getVLC("vlc");
var info = document.getElementById("info");
if( vlc )
{
var mediaLen = vlc.input.length;
if( mediaLen > 0 )
{
// seekable media
info.innerHTML = formatTime(time)+"/"+formatTime(mediaLen);
}
}
}
function handle_MediaPlayerPositionChanged(val)
{
// set javascript slider to correct position
}
function handle_MediaPlayerSeekableChanged(val)
{
setSeekable(val);
}
function handle_MediaPlayerPausableChanged(val)
{
setPauseable(val);
}
function handle_MediaPlayerTitleChanged(val)
{
//setTitle(val);
document.getElementById("info").innerHTML = "Title: " + val;
}
function handle_MediaPlayerLengthChanged(val)
{
//setMediaLength(val);
}
// VLC Plugin
function onVLCPluginReady()
{
registerVLCEvent("MediaPlayerMediaChanged", handleMediaPlayerMediaChanged);
registerVLCEvent("MediaPlayerNothingSpecial", handle_MediaPlayerNothingSpecial);
registerVLCEvent("MediaPlayerOpening", handle_MediaPlayerOpening);
registerVLCEvent("MediaPlayerBuffering", handle_MediaPlayerBuffering);
registerVLCEvent("MediaPlayerPlaying", handle_MediaPlayerPlaying);
registerVLCEvent("MediaPlayerPaused", handle_MediaPlayerPaused);
registerVLCEvent("MediaPlayerStopped", handle_MediaPlayerStopped);
registerVLCEvent("MediaPlayerForward", handle_MediaPlayerForward);
registerVLCEvent("MediaPlayerBackward", handle_MediaPlayerBackward);
registerVLCEvent("MediaPlayerEndReached", handle_MediaPlayerEndReached);
registerVLCEvent("MediaPlayerEncounteredError", handle_MediaPlayerEncounteredError);
registerVLCEvent("MediaPlayerTimeChanged", handle_MediaPlayerTimeChanged);
registerVLCEvent("MediaPlayerPositionChanged", handle_MediaPlayerPositionChanged);
registerVLCEvent("MediaPlayerSeekableChanged", handle_MediaPlayerSeekableChanged);
registerVLCEvent("MediaPlayerPausableChanged", handle_MediaPlayerPausableChanged);
registerVLCEvent("MediaPlayerTitleChanged", handle_MediaPlayerTitleChanged);
registerVLCEvent("MediaPlayerLengthChanged", handle_MediaPlayerLengthChanged);
}
function close()
{
unregisterVLCEvent("MediaPlayerMediaChanged", handleMediaPlayerMediaChanged);
unregisterVLCEvent("MediaPlayerNothingSpecial", handle_MediaPlayerNothingSpecial);
unregisterVLCEvent("MediaPlayerOpening", handle_MediaPlayerOpening);
unregisterVLCEvent("MediaPlayerBuffering", handle_MediaPlayerBuffering);
unregisterVLCEvent("MediaPlayerPlaying", handle_MediaPlayerPlaying);
unregisterVLCEvent("MediaPlayerPaused", handle_MediaPlayerPaused);
unregisterVLCEvent("MediaPlayerStopped", handle_MediaPlayerStopped);
unregisterVLCEvent("MediaPlayerForward", handle_MediaPlayerForward);
unregisterVLCEvent("MediaPlayerBackward", handle_MediaPlayerBackward);
unregisterVLCEvent("MediaPlayerEndReached", handle_MediaPlayerEndReached);
unregisterVLCEvent("MediaPlayerEncounteredError", handle_MediaPlayerEncounteredError);
unregisterVLCEvent("MediaPlayerTimeChanged", handle_MediaPlayerTimeChanged);
unregisterVLCEvent("MediaPlayerPositionChanged", handle_MediaPlayerPositionChanged);
unregisterVLCEvent("MediaPlayerSeekableChanged", handle_MediaPlayerSeekableChanged);
unregisterVLCEvent("MediaPlayerPausableChanged", handle_MediaPlayerPausableChanged);
unregisterVLCEvent("MediaPlayerTitleChanged", handle_MediaPlayerTitleChanged);
unregisterVLCEvent("MediaPlayerLengthChanged", handle_MediaPlayerLengthChanged);
}
//--></script>
<body onLoad="init();" onClose="close();">
<div style="width: 800; height: 200; top:200px; position: absolute; border: 1pt solid black; background: blue; border-radius: 5px; display: none;" id="overlay"></div>
<table>
<tr><td align="center" colspan="2">
<div id=player>
<!--
Insert VideoLAN.VLCPlugin.2
-->
<object classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
width="640"
height="480"
id="vlc"
windowless="True"
events="True">
<param name="MRL" value="" />
<param name="ShowDisplay" value="True" />
<param name="AutoLoop" value="False" />
<param name="AutoPlay" value="False" />
<param name="Volume" value="50" />
<param name="toolbar" value="true" />
<param name="StartTime" value="0" />
<EMBED pluginspage="http://www.videolan.org"
type="application/x-vlc-plugin"
version="VideoLAN.VLCPlugin.2"
width="640"
height="480"
toolbar="true"
loop="true"
text="Waiting for video"
windowless="true"
name="vlc">
</EMBED>
</object>
</div>
</td></tr>
<tr><td colspan="2">
MRL:
<input size="90" id="targetTextField" value="">
<input type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">
<input type=submit value="Add" onClick="doAdd(document.getElementById('targetTextField').value);">
</td></tr>
<tr><td>
<input type=button id="PlayOrPause" value=" Play " onClick='doPlayOrPause();'>
<input type=button value="Stop" onClick='doStop();'>
</td><td width="15%">
<div id="info" style="text-align:center">-:--:--/-:--:--</div>
<div id="state" style="text-align:center">Stopped...</div>
</td>
</tr>
<tr>
<td>
<input type=button value="3D transform" onClick='doToggle3dTransform();'>
<input type=button value="Change opacity" onClick='doToggleOpacity();'>
<input type=button value="Rounded corners" onClick='doToggleRound();'>
</td>
</tr>
</table>
<SCRIPT language="javascript">
<!--
var rate = 0;
var prevState = 0;
var telxState = false;
var canPause = true;
var canSeek = true;
function setPauseable(val)
{
canPause = val;
}
function setSeekable(val)
{
canSeek = val;
}
function doSetSlider()
{
var vlc = getVLC("vlc");
// set slider to new position
if( vlc )
vlc.input.time = (vlc.input.length/2);
}
function doGetPosition()
{
var vlc = getVLC("vlc");
// set slider to new position
if (vlc)
alert( "position is " + vlc.input.time);
}
function doReverse(rate)
{
var vlc = getVLC("vlc");
if( vlc )
vlc.input.rate = -1.0 * vlc.input.rate;
}
function doAudioChannel(value)
{
var vlc = getVLC("vlc");
if( vlc )
vlc.audio.channel = parseInt(value);
}
function doAudioTrack(value)
{
var vlc = getVLC("vlc");
if( vlc )
{
vlc.audio.track = vlc.audio.track + value;
document.getElementById("trackTextField").innerHTML = vlc.audio.track;
}
}
function doAspectRatio(value)
{
var vlc = getVLC("vlc");
if( vlc )
vlc.video.aspectRatio = value;
}
function doSubtitle(value)
{
var vlc = getVLC("vlc");
if( vlc )
{
vlc.subtitle.track = vlc.subtitle.track + value;
document.getElementById("spuTextField").innerHTML = vlc.subtitle.track;
}
}
function doTelxPage(value)
{
var vlc = getVLC("vlc");
if( vlc )
vlc.video.teletext = parseInt(value);
}
function doToggleTeletext()
{
var vlc = getVLC("vlc");
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 doToggle3dTransform()
{
var vlc = getVLC("vlc");
var transform = "rotate3d(1,2,1, 45deg)";
if( vlc )
{
if (!vlc.style.transform)
{
vlc.style.transform = transform;
vlc.style.webkitTransform = transform;
}
else
{
vlc.style.transform = '';
vlc.style.webkitTransform = '';
}
}
}
function doToggleOpacity()
{
var vlc = getVLC("vlc");
var opacity = "0.5";
if( vlc )
{
if (!vlc.style.opacity)
{
vlc.style.opacity = opacity;
}
else
{
vlc.style.opacity = '';
}
}
}
function doToggleRound()
{
var vlc = getVLC("vlc");
var corner = "80px";
if( vlc )
{
if (!vlc.style.borderRadius)
{
vlc.style.borderRadius = corner;
}
else
{
vlc.style.borderRadius = '';
}
}
}
function doItemCount()
{
var vlc = getVLC("vlc");
if( vlc )
{
var count = vlc.playlist.items.count;
document.getElementById("itemCount").value = " Items " + count + " ";
}
}
function doRemoveItem(item)
{
var vlc = getVLC("vlc");
if( vlc )
vlc.playlist.items.remove(item);
}
function doPlaylistClearAll()
{
var vlc = getVLC("vlc");
if( vlc )
{
vlc.playlist.items.clear();
while( vlc.playlist.items.count > 0)
{
// wait till playlist empties.
}
doItemCount();
}
}
function updateVolume(deltaVol)
{
var vlc = getVLC("vlc");
if( vlc )
{
vlc.audio.volume += deltaVol;
document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
}
}
function formatTime(timeVal)
{
if( typeof timeVal != 'number' )
return "-:--:--";
var timeHour = Math.round(timeVal / 1000);
var timeSec = timeHour % 60;
if( timeSec < 10 )
timeSec = '0'+timeSec;
timeHour = (timeHour - timeSec)/60;
var timeMin = timeHour % 60;
if( timeMin < 10 )
timeMin = '0'+timeMin;
timeHour = (timeHour - timeMin)/60;
if( timeHour > 0 )
return timeHour+":"+timeMin+":"+timeSec;
else
return timeMin+":"+timeSec;
}
// Old method of querying current state
// function doState() - depreceated
function doState()
{
var vlc = getVLC("vlc");
var newState = 0;
if( vlc )
newState = vlc.input.state;
if( newState == 0 )
{
// current media has stopped
onEnd();
}
else if( newState == 1 )
{
// current media is openning/connecting
onOpen();
}
else if( newState == 2 )
{
// current media is buffering data
onBuffer();
}
else if( newState == 3 )
{
// current media is now playing
onPlay();
}
else if( newState == 4 )
{
// current media is now paused
onPause();
}
else if( newState == 5 )
{
// current media has stopped
onStop();
}
else if( newState == 6 )
{
// current media has ended
onEnd();
}
else if( newState == 7 )
{
// current media encountered error
onError();
}
}
/* actions */
function doGo(targetURL)
{
var vlc = getVLC("vlc");
if( vlc )
{
vlc.playlist.items.clear();
while( vlc.playlist.items.count > 0 )
{
// clear() may return before the playlist has actually been cleared
// just wait for it to finish its job
}
var options = [":rtsp-tcp"];
var itemId = vlc.playlist.add(targetURL,"",options);
options = [];
if( itemId != -1 )
{
// play MRL
vlc.playlist.playItem(itemId);
}