Ver Mensaje Individual
  #2 (permalink)  
Antiguo 17/02/2010, 22:10
Avatar de infiero
infiero
 
Fecha de Ingreso: marzo-2006
Mensajes: 38
Antigüedad: 18 años, 1 mes
Puntos: 3
Respuesta: Sistema de camaras en web

Bueno paso a dar la autorespuesta
logre solucionar mi problema, y paso a dejar el codigo completo que use para poder
poner los 3 videos, y la seleccion de los mismos
con una mascara de codigo, Espero que a algun desamparado le sirva ;D


Código HTML:
Ver original
  1. <script language="Javascript">
  2. function aparecer(id) {
  3.     var d = document.getElementById(id);
  4.     d.style.display = "block";
  5.     d.style.visibility = "visible";
  6. }
  7. function ocultar(id) {
  8.     var d = document.getElementById(id);
  9.     d.style.display = "none";
  10.     d.style.visibility = "hidden";
  11. }
  12. window.onload = function () {
  13.     //Al cargar la página se oculta el div de consulta
  14.     ocultar("jpg");
  15.     ocultar("flash");
  16.    
  17.    
  18. }
  19. </script>
  20. </head>
  21.     <tr>
  22.         <td scope="col">
  23.             <div align="center">
  24.                 <a href="#java" onClick="ocultar('jpg');ocultar('flash');aparecer('java');">Java</a> -
  25.                 <a href="#jpg" onClick="ocultar('java');ocultar('flash');aparecer('jpg');">Jpg</a> -
  26.                 <a href="#flash" onClick="ocultar('java');ocultar('jpg');aparecer('flash');">Flash</a> -
  27.             </div>
  28.         </td>
  29.     </tr>
  30. <div id="java" style="position:absolute;text-align:center;top:100px;left:200px;border:solid 1px red;"><img src="http://anicomics.dyndns.org:8080/loading.jpg" class="webcam" id="webcam1" onMouseDown="PTZMouseDown1(event)" width="320" height="240" alt="Live Stream" />
  31. <script type="text/javascript">
  32. <!--
  33. currentCamera1= 1;
  34. errorimg1= 0;
  35. document.images.webcam1.onload = DoIt1;
  36. document.images.webcam1.onerror = ErrorImage1;
  37. function LoadImage1()
  38. {
  39.        uniq1 = Math.random();
  40.        document.images.webcam1.src = "http://anicomics.dyndns.org:8080/cam_" + currentCamera1 + ".jpg?uniq="+uniq1;
  41.        document.images.webcam1.onload = DoIt1;
  42. }
  43. function PTZMouseDown1(e)
  44. {
  45.        var IE = document.all?true:false;
  46.        var x,y;
  47.        var myx,myy;
  48.        var myifr = document.getElementById("_iframe-ptz");
  49.        tp = getElPos1();
  50.        myx = tp[0];
  51.        myy = tp[1];
  52.        if(IE){
  53.        var scrollX = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft;
  54.        var scrollY = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
  55.        x = event.clientX - myx + scrollX;
  56.        y = event.clientY - myy + scrollY;
  57.        } else {
  58.        x = e.pageX - myx;
  59.        y = e.pageY - myy;
  60.        }
  61.        if (width_array[currentCamera1] > 0) x = Math.round((x * 400) / width_array[currentCamera1]);
  62.        if (height_array[currentCamera1] > 0) y = Math.round((y * 300) / height_array[currentCamera1]);
  63.        if (x > 400) x = 400;
  64.        if (y > 300) y = 300;
  65.        if (myifr != null) myifr.src = "http://anicomics.dyndns.org:8080/ptz?src=" + currentCamera1 + "&moveto_x=" + x + "&moveto_y=" + y +"";
  66.        return true;
  67. }
  68. function getElPos1()
  69. {
  70.            el = document.images.webcam1;
  71.            x = el.offsetLeft;
  72.            y = el.offsetTop;
  73.            elp = el.offsetParent;
  74.            while(elp!=null)
  75.              { x+=elp.offsetLeft;
  76.                y+=elp.offsetTop;
  77.                elp=elp.offsetParent;
  78.              }
  79.            return new Array(x,y);
  80. }
  81. function ErrorImage1()
  82. {
  83.        errorimg1++;
  84.        if (errorimg1>3){
  85.              document.images.webcam1.onload = "";
  86.              document.images.webcam1.onerror = "";
  87.              document.images.webcam1.src = "offline.jpg";
  88.              }else{
  89.                uniq1 = Math.random();
  90.            document.images.webcam1.src = "http://anicomics.dyndns.org:8080/cam_" + currentCamera1 + ".jpg?uniq="+uniq1;
  91.              }
  92. }
  93. function DoIt1()
  94. {
  95.        errorimg1=0;
  96.        window.setTimeout("LoadImage1();", 40);
  97. }
  98. //-->
  99. </div>
  100. <div id="jpg" style="position:absolute;text-align:center;top:100px;left:200px;border:solid 1px red;"><img src="http://anicomics.dyndns.org:8080/cam_1.cgi" class="webcam" id="webcam1" onMouseDown="PTZMouseDown1(event)" width="320" height="240" alt="Live Stream" />
  101. <script type="text/javascript">
  102. <!--
  103. currentCamera1= 1;
  104. function PTZMouseDown1(e)
  105. {
  106.        var IE = document.all?true:false;
  107.        var x,y;
  108.        var myx,myy;
  109.        var myifr = document.getElementById("_iframe-ptz");
  110.        tp = getElPos1();
  111.        myx = tp[0];
  112.        myy = tp[1];
  113.        if(IE){
  114.        x = event.clientX - myx + document.body.scrollLeft;
  115.        y = event.clientY - myy + document.body.scrollTop;
  116.        } else {
  117.        x = e.pageX - myx;
  118.        y = e.pageY - myy;
  119.        }
  120.        //alert(x + " :: " + y);
  121.        if (width_array[currentCamera1] > 0) x = Math.round((x * 400) / width_array[currentCamera1]);
  122.        if (height_array[currentCamera1] > 0) y = Math.round((y * 300) / height_array[currentCamera1]);
  123.        //alert(x + " :: " + y);
  124.        if (myifr != null) myifr.src = "http://anicomics.dyndns.org:8080/ptz?src=" + currentCamera1 + "&moveto_x=" + x + "&moveto_y=" + y +"";
  125.        return true;
  126. }
  127. function getElPos1()
  128. {
  129.            el = document.images.webcam1;
  130.            x = el.offsetLeft;
  131.            y = el.offsetTop;
  132.            elp = el.offsetParent;
  133.            while(elp!=null)
  134.              { x+=elp.offsetLeft;
  135.                y+=elp.offsetTop;
  136.                elp=elp.offsetParent;
  137.              }
  138.            return new Array(x,y);
  139. }
  140. //-->
  141. </div>
  142. <div id="flash" style="position:absolute;text-align:center;top:100px;left:200px;border:solid 1px red;"><object type="application/x-shockwave-flash" width="320" height="240" data="../webcamxp.swf">
  143. <param name="movie" value="webcamxp.swf?webcam=http://anicomics.dyndns.org:8080/cam_1.jpg&amp;refresh=50&amp;connect=&amp;offline=&amp;transtype=Fade&amp;bgcolor=#FFFFFF&amp;txtcolor=#808080" />
  144. <param name="FlashVars" value="webcam=http://anicomics.dyndns.org:8080/cam_1.jpg&amp;refresh=50&amp;connect=&amp;offline=&amp;transtype=Fade&amp;bgcolor=#FFFFFF&amp;txtcolor=#808080" />
  145. <param name="loop" value="false" />
  146. <param name="menu" value="false" />
  147. <param name="quality" value="best" />
  148. <param name="scale" value="noscale" />
  149. <param name="salign" value="lt" />
  150. <param name="wmode" value="opaque" />
  151. </div>
  152. </body>
  153. </html>