aboutsummaryrefslogtreecommitdiff
path: root/templates/client.html.bak
diff options
context:
space:
mode:
Diffstat (limited to 'templates/client.html.bak')
-rw-r--r--templates/client.html.bak41
1 files changed, 41 insertions, 0 deletions
diff --git a/templates/client.html.bak b/templates/client.html.bak
new file mode 100644
index 0000000..9a4ff08
--- /dev/null
+++ b/templates/client.html.bak
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Client {{ client_id }} - Camera Streams</title>
+ <style>
+ .camera-stream { display: inline-block; margin: 10px; }
+ video { border: 1px solid #333; }
+ </style>
+</head>
+<body>
+ <h1>Camera Streams for Client {{ client_id }}</h1>
+ {% for camera_id in camera_ids %}
+ <div class="camera-stream">
+ <h2>Camera {{ camera_id }}</h2>
+ <img id="video-{{ camera_id }}" width="640" height="480" />
+ </div>
+ {% endfor %}
+ <script>
+ {% for camera_id in camera_ids %}
+ (function() {
+ // const ws = new WebSocket("ws://127.0.0.1:8008/ws/client_task/front_camera");
+ const ws = new WebSocket("ws://${location.host}/ws/{{ client_id }}/{{ camera_id }}");
+ const img = document.getElementById("video-{{ camera_id }}");
+ ws.binaryType = "arraybuffer";
+ ws.onopen = function(event) {
+ console.log("Connection on websocket open");
+ }
+ ws.onmessage = function(event) {
+ console.log("Received frame data size: ", event.data.byteLength);
+ const blob = new Blob([event.data], {type: "image/jpeg"});
+ // document.getElementById("video").src = URL.createObjectURL(blob);
+ img.src = URL.createObjectURL(blob);
+ };
+ ws.onerror = function(event) {
+ console.error("Websocket error: ", event);
+ };
+ })();
+ {% endfor %}
+ </script>
+</body>
+</html>