2014-02-28 01:13:54 +01:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf8" />
|
|
|
|
<link rel="stylesheet" type="text/css" href="style/styles.css">
|
|
|
|
<title>Acces camera</title>
|
2014-03-01 21:45:37 +01:00
|
|
|
<script src="js/jquery-2.1.0.min.js"></script>
|
|
|
|
<script >
|
2014-03-03 21:42:52 +01:00
|
|
|
var ws = new WebSocket ("{{ url }}/");
|
2014-02-28 07:14:25 +01:00
|
|
|
ws.onmessage = function (evt) {
|
2014-03-01 18:29:32 +01:00
|
|
|
console.log("data receive");
|
2014-03-01 18:25:38 +01:00
|
|
|
if(evt.data != "error") {
|
2014-03-01 18:29:32 +01:00
|
|
|
console.log("data OK !");
|
2014-03-01 18:25:38 +01:00
|
|
|
var str = "<img src='data:image/jpeg;base64,"+evt.data+"'>";
|
|
|
|
}
|
2014-03-01 18:29:32 +01:00
|
|
|
else {
|
|
|
|
console.log("data NOK !");
|
2014-03-01 18:35:37 +01:00
|
|
|
var str = "<p>Erreur : image camera indisponible</p>";
|
2014-03-01 18:29:32 +01:00
|
|
|
}
|
2014-03-01 18:31:14 +01:00
|
|
|
$('.image').html(str);
|
2014-02-28 03:36:53 +01:00
|
|
|
}
|
2014-02-28 07:14:25 +01:00
|
|
|
ws.onopen = function () {
|
|
|
|
console.log("websocket engage");
|
2014-03-03 18:49:35 +01:00
|
|
|
document.cookie = encodeURIComponent("user") + "=deleted; expires=" + new Date(0).toUTCString();
|
2014-02-28 07:14:25 +01:00
|
|
|
};
|
|
|
|
ws.onclose = function () {
|
|
|
|
console.log("connection closed");
|
|
|
|
};
|
2014-02-28 07:47:51 +01:00
|
|
|
window.onbeforeunload=function(){
|
2014-02-28 07:43:20 +01:00
|
|
|
ws.close();
|
|
|
|
};
|
2014-03-01 17:52:22 +01:00
|
|
|
function refresh() {
|
2014-03-01 18:18:05 +01:00
|
|
|
console.log("Data send");
|
2014-03-02 21:19:15 +01:00
|
|
|
ws.send("next");
|
2014-03-01 17:52:22 +01:00
|
|
|
}
|
2014-02-28 02:12:24 +01:00
|
|
|
</script>
|
2014-02-28 01:13:54 +01:00
|
|
|
</head>
|
2014-03-01 18:40:35 +01:00
|
|
|
<body onload="javascript:setInterval('refresh();',2000)">
|
2014-02-28 01:13:54 +01:00
|
|
|
<h2>Vue camera</h2>
|
2014-02-28 03:50:12 +01:00
|
|
|
<div class="image"></div>
|
2014-02-28 04:19:03 +01:00
|
|
|
<form action="/disconnection" method="post">
|
|
|
|
<input type="submit" value="Deconnexion">
|
|
|
|
</form>
|
2014-02-28 01:13:54 +01:00
|
|
|
</body>
|
|
|
|
</html>
|
2014-02-28 07:14:25 +01:00
|
|
|
|