<html> <head> <title>Go Pro cliente</title> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script type="text/javascript" charset="utf-8"> var flag = false; var imgArray = new Array(); $(document).ready(function(){ if ("WebSocket" in window) { var ws_path = 'ws://' + window.location.host + window.location.pathname + 'ws'; //alert(ws_path); var ws = new WebSocket (ws_path); //alert(ws); ws.onopen = function () { ws.send(1); }; ws.onmessage = function (msg) { $("#cam").attr('src', 'data:image/jpg;base64,' + msg.data); if ( flag == true) { $("#img").attr('src', 'data:image/jpg;base64,' + msg.data); flag = false; var url = img.src.replace('data:image/jpg;base64,' + msg.data); } ws.send(1); }; ws.onerror = function (e) { console.log(e); ws.send(1); }; } else { alert("WebSocket no soportado"); } }); function capture() { flag = true; }; </script> </head> <body> <div id="video"><center> <H1>Video caputado desde Go Pro</H1> <img id="cam" src=""/><br> <button id="capture" onclick="capture();" type="button">Screen Shot</button> </div> <div id="screenshot"> <h2><center>Capturas tomadas</h2> <img id="url" src="" /><br> </div> <a id="acapture" href="" download="" style="display : none"></a> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)