diff options
| author | Franoosh <uinarf@autistici.org> | 2025-07-25 17:13:38 +0200 | 
|---|---|---|
| committer | Franoosh <uinarf@autistici.org> | 2025-10-15 14:33:59 +0200 | 
| commit | 68bd1bd052a7cd6438b92cb1059ef5e58b8d022c (patch) | |
| tree | 5a7eab3022a7593bd3d9dbdcc99a1590ab0fc3bc /templates/client.html.bak | |
| download | ZeroMQ_Video_Streaming-68bd1bd052a7cd6438b92cb1059ef5e58b8d022c.tar.gz ZeroMQ_Video_Streaming-68bd1bd052a7cd6438b92cb1059ef5e58b8d022c.tar.bz2 ZeroMQ_Video_Streaming-68bd1bd052a7cd6438b92cb1059ef5e58b8d022c.zip | |
Initial commit. Proof of concept message passing between client <-> router <-> worker with rudimentary caching
Diffstat (limited to 'templates/client.html.bak')
| -rw-r--r-- | templates/client.html.bak | 41 | 
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> | 
