<html>
<script language='javascript'>
var EndplayersRequired=80;
var startEndplayersRequired=71;

var Assetname ='constantine.mpg';
var URL='rtsp://192.168.5.55:554/1216.mpg';
var vlcplugin;
var playerVLC;

function showVLCProperties()
{
   var st = "";
   for(p in vlcplugin)
   {
      st += "\n" + p;
   }
   
   document.getElementById("VLCPROP").value = st;
}

function createVLC()
{
var Vlcplayer=[];
try{
    Vlcplayer='<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org"  ';  
     Vlcplayer+= 'id="mymovie" target="'+URL+'" name="mymovie" height="100%" width="100%" ></embed>  ';
 
  playerVLC =document.getElementById("playerVLC");

playerVLC.innerHTML =Vlcplayer;


vlcplugin =document.getElementById("mymovie");
vlcplugin.addEventListener("onChange", chiru,false);

}
catch(ex)
{
alert("vlc error"+ex);
}
}
function play()
{
try{
vlcplugin.input.rate = 1.0;
vlcplugin.playlist.play();
}
catch(ex){
alert('already playing reply'+ex);
}

}
function pause()
{
try{
vlcplugin.playlist.togglePause();
}
catch(ex){
alert('already pause reply'+ex);
}

}

function stop(){

try{
vlcplugin.playlist.stop();
}
catch(ex){
alert('playing stop error'+ex);
}

}
function Subtitle()
{
try{
vlcplugin.video.subtitle = 1;
alert("chiru "+vlcplugin.video.subtitle);
}
catch(ex){
alert('playing Subtitle error'+ex);
}

}
function forward()
{
try{
vlcplugin.input.rate = 8.0;
}
catch(ex){
alert("forward is called" +ex);
}

}


function resize(v)
{
try{
/*
        if(v!=1){
                window.setTimeout(function(){resize(1)},400);
                return;
        }
*/
        var cDiv = document.getElementById('playerVLC');
        if(cDiv && cDiv.style.height !="100px"){
                var stl = cDiv.style;
                stl.position="absolute";
                stl.height="100px";
                stl.height="100px";
                stl.left="100px";
                stl.top="100px";
        }else if(cDiv){
                
                var stl = cDiv.style;
                stl.position="absolute";
                stl.height="400px";
                stl.height="400px";
                stl.left="300px";
                stl.top="100px";
        }
}catch(ex){
        alert("Error in resize:" +ex);
}
}
function teletext()
{
try{
vlcplugin.video.teletext =1;
alert("chiru "+vlcplugin.video.teletext);
}
catch(ex){
alert("teletext is called" +ex);
}

}


function rewind(){
try{
vlcplugin.input.rate = vlcplugin.input.rate - 1.0; ;
}
catch(ex){
alert("rewind is called" +ex);
}
}


function startEvents(){

alert(vlcplugin.input.time+"vlcplugin.input.position  :::: "+vlcplugin.input.position+"startEvents :::vlcplugin::: "+vlcplugin.input.state);

}

function chiru()
{
   document.getElementById("chiru").innerHTML += "POSTION IS DISPLAYIN HERE"+vlcplugin.input.position+"</br>";
   
   //0 =IDLE/CLOSEIS OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4, STOPPING=5, ENDED=6, ERROR=7
     switch(vlcplugin.input.state)
     {
        case 0: 
                //document.getElementById("chiru").innerHTML += "IDLE/CLOSEIS DISPLAYING HERE </br>";
                 break;
        case 3: 
               // document.getElementById("chiru").innerHTML += "PLAYING ******* IS DISPLAYING HERE </br>";
                 break;
        case 5: 
               // document.getElementById("chiru").innerHTML += "STOPPING IS DISPLAYING HERE</br>";
                 break;
        case 6: 
                //document.getElementById("chiru").innerHTML += "ENDED IS DISPLAYING HERE</br>";
                 break;
        case 7:
               // document.getElementById("chiru").innerHTML += "ERROR IS DISPLAYING HERE</br>"; 
                 break;  
        case 1: 
                // document.getElementById("chiru").innerHTML += "OPENING IS DISPLAYING HERE</br>";
                 break;                               
        case 2: 
                // document.getElementById("chiru").innerHTML += "BUFFERING IS DISPLAYING HERE</br>";
                 break;
                 
       case 4: 
               //  document.getElementById("chiru").innerHTML += "PAUSED IS DISPLAYING HERE</br>";
                 break;
     
     }
                 
      //       document.getElementById("chiru").innerHTML = vlcplugin.input.position;
             
  //setInterval( "chiru()", 1000 );
       
 }


 function showHideDiv()
 {
   var osdDiv = document.getElementById("OSDDIV")
   if(osdDiv.style.visibility == "hidden")
   {
      osdDiv.style.visibility = "visible";
   }
   else
   {
      osdDiv.style.visibility = "hidden";
   }
 
 }

</script>
<style type="text/css">
<!--

-->
</style>
<body onload='createVLC()' style='background:#777'>

<div style="float:left;" >
<input type="button" id="Play" size="20"  height="15" value="Play" onclick='play();' />
<input type="button" id="Pause" size="20"  height="15" value="Pause" onclick='pause();' />
<input type="button" id="stop" size="20"  height="15"  value="stop" onclick='stop();'/>
<input type="button" id="forward" size="20"  height="15"  value="forward" onclick='forward();'/>
<input type="button" id="rewind" size="20"  height="15" value="rewind"  onclick='rewind();' />
<input type="button" id="start events" size="20"  height="15"  value="start events" onclick ='startEvents();'/> 
<input type="button" id="Subtitle" size="20"  height="15" value="Subtitle"  onclick='Subtitle();' />
<input type="button" id="Teletext" size="20"  height="15" value="Teletext"  onclick='teletext();' />
<input type="button" id="resize" size="20"  height="15" value="resize"  onclick='resize();' />
</div>
<hr>

<div id="playerVLC" style="z-index:24;position:absolute;top:300px;left:100px;height:400px;width:400px;"></div>
<div id="chiru"></div>


</body>
</html>