test.html 3.97 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<HTML>
<TITLE>VLC Mozilla plugin test page</TITLE>
<BODY>
<TABLE>
<TR><TD colspan="2">
MRL:
<INPUT size="90" id="targetTextField" value="">
<INPUT type=submit value="Go" onClick="doGo(document.getElementById('targetTextField').value);">
</TD></TR>
<TR><TD colspan="2">
<EMBED  type="application/x-vlc-plugin" pluginspage="http://www.videolan.org/" version="VideoLAN.VLCPlugin.2"
        width="640"
        height="480"
        id="vlc">
</EMBED>
</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 22
<INPUT type=button value=" << " onClick='doPlaySlower();'>
<INPUT type=button value=" >> " onClick='doPlayFaster();'>
23
&nbsp;
24
<INPUT type=button value="Version" onClick='alert(document.getElementById("vlc"));'>
25 26 27 28
<SPAN style="text-align:center">Volume:</SPAN>
<INPUT type=button value=" - " onClick='updateVolume(-10)'>
<SPAN id="volumeTextField" style="text-align: center">--</SPAN>
<INPUT type=button value=" + " onClick='updateVolume(+10)'>
29 30 31 32
<INPUT type=button value="Mute" onClick='document.getElementById("vlc").audio.toggleMute();'>
</TD><TD width="15%">
<DIV id="info" style="text-align:center">-:--:--/-:--:--</DIV>
</TD></TR>
33 34 35 36 37 38 39
</TABLE>
<SCRIPT LANGUAGE="Javascript">
<!--
var timerId = 0;

function updateVolume(deltaVol)
{
40 41
    var vlc = document.getElementById("vlc");
    vlc.audio.volume += deltaVol;
42
    document.getElementById("volumeTextField").innerHTML = vlc.audio.volume+"%";
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
};
function formatTime(timeVal)
{
    var timeHour = timeVal;
    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;
};
function onPlay()
{
    document.getElementById("PlayOrPause").value = "Pause";
};
function onPause()
{
    document.getElementById("PlayOrPause").value = " Play ";
};
function onStop()
{
70
    document.getElementById("info").innerHTML = "-:--:--/-:--:--";
71 72 73 74 75 76 77
    document.getElementById("PlayOrPause").value = " Play ";
};
var liveFeedText = new Array("Live", "((Live))", "(( Live ))", "((  Live  ))");
var liveFeedRoll = 0;

function doUpdate()
{
78
    var vlc = document.getElementById("vlc");
79
    if( vlc.playlist.isPlaying )
80 81 82 83
    {
        if( vlc.input.length > 0 )
        {
            // seekable stream
84
            document.getElementById("info").innerHTML = formatTime(vlc.input.time/1000)+"/"+formatTime(vlc.input.length/1000);
85 86 87 88
            document.getElementById("PlayOrPause").Enabled = true;
        }
        else {
            liveFeedRoll = liveFeedRoll & 3;
89
            document.getElementById("info").innerText = liveFeedText[liveFeedRoll++];
90 91 92 93 94 95 96 97 98 99 100 101
        }
        timerId = setTimeout("doUpdate()", 1000);
    }
    else
    {
        onStop();
        timerId = 0;
    }
};
function doGo(targetURL)
{
	var options = new Array(":vout-filter=deinterlace", ":deinterlace-mode=linear");
102
	document.getElementById("vlc").playlist.add(targetURL, null, options);
103 104 105
};
function doPlayOrPause()
{
106
    var vlc = document.getElementById("vlc");
107
    if( vlc.playlist.isPlaying )
108
    {
109
        vlc.playlist.pause();
110 111 112
    }
    else
    {
113
        vlc.playlist.play();
114 115
    }
};
116 117 118 119 120 121 122 123 124 125
function doPlaySlower()
{
    var vlc = document.getElementById("vlc");
    vlc.input.rate = vlc.input.rate / 2;
};
function doPlayFaster()
{
    var vlc = document.getElementById("vlc");
    vlc.input.rate = vlc.input.rate * 2;
};
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
function vlcPlayEvent()
{
    if( ! timerId )
    {
        timerId = setTimeout("doUpdate()", 1000);
    }
    onPlay();
};
function vlcPauseEvent()
{
    if( timerId )
    {
        clearTimeout(timerId)
        timerId = 0;
    }
    onPause();
};
function vlcStopEvent()
{
    if( timerId )
    {
        clearTimeout(timerId)
        timerId = 0;
    }
    onStop();
};
//-->
</SCRIPT>
</BODY>
</HTML>