mirror of
https://github.com/gen2brain/cam2ip.git
synced 2026-05-03 11:22:35 +00:00
Format HTML, improve performance a bit
This commit is contained in:
@@ -48,29 +48,18 @@ var html = `<html>
|
||||
<script>
|
||||
var url = "ws://{BIND}/socket";
|
||||
ws = new WebSocket(url);
|
||||
var image = new Image();
|
||||
|
||||
ws.onopen = function() {
|
||||
console.log("onopen");
|
||||
}
|
||||
|
||||
ws.onmessage = function(e) {
|
||||
var context = document.getElementById("canvas").getContext("2d");
|
||||
|
||||
var image = new Image();
|
||||
image.onload = function() {
|
||||
context.drawImage(image, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
ws.onmessage = function(e) {
|
||||
image.setAttribute("src", "data:image/jpeg;base64," + e.data);
|
||||
}
|
||||
|
||||
ws.onclose = function(e) {
|
||||
console.log("onclose");
|
||||
}
|
||||
|
||||
ws.onerror = function(e) {
|
||||
console.log("onerror");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color: #000000">
|
||||
|
||||
Reference in New Issue
Block a user