This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
DUT2PTUT/v/video.html

46 lines
1.5 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf8" />
<link rel="stylesheet" type="text/css" href="style/styles.css">
<title>Acces camera</title>
<script src="js/jquery-2.1.0.min.js"></script>
<script >
var ws = new WebSocket ("ws://192.168.1.12/socket");
ws.onmessage = function (evt) {
2014-03-01 17:29:32 +00:00
console.log("data receive");
if(evt.data != "error") {
2014-03-01 17:29:32 +00:00
console.log("data OK !");
var str = "<img src='data:image/jpeg;base64,"+evt.data+"'>";
}
2014-03-01 17:29:32 +00:00
else {
console.log("data NOK !");
var str = "<p>Erreur : image camera indisponible</p>";
2014-03-01 17:29:32 +00:00
}
2014-03-01 17:31:14 +00:00
$('.image').html(str);
2014-02-28 02:36:53 +00:00
}
ws.onopen = function () {
console.log("websocket engage");
};
ws.onclose = function () {
console.log("connection closed");
};
2014-02-28 06:47:51 +00:00
window.onbeforeunload=function(){
ws.close();
};
function refresh() {
2014-03-01 17:18:05 +00:00
console.log("Data send");
ws.send("next");
}
</script>
</head>
2014-03-01 17:40:35 +00:00
<body onload="javascript:setInterval('refresh();',2000)">
<h2>Vue camera</h2>
2014-02-28 02:50:12 +00:00
<div class="image"></div>
<form action="/disconnection" method="post">
<input type="submit" value="Deconnexion">
</form>
</body>
</html>