diff options
Diffstat (limited to 'templates/main.html.bak')
| -rw-r--r-- | templates/main.html.bak | 35 | 
1 files changed, 35 insertions, 0 deletions
| diff --git a/templates/main.html.bak b/templates/main.html.bak new file mode 100644 index 0000000..7bb2ee5 --- /dev/null +++ b/templates/main.html.bak @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +    <head> +        <title>Live Streaming</title> +    </head> +    <body> +        <img id="frame" src=""> +        <h1>Streaming. Live.</h1> +        <script> +            let ws = new WebSocket("ws://127.0.0.1:8880/{{client_id}}/{{camera_id}}"); +            let image = document.getElementById("frame"); +            let currentUrl = null; + +            ws.onmessage = function(event) { +                if (currentUrl) { +                    URL.revokeObjectURL(currentUrl); +                } +                currentUrl = URL.createObjectURL(event.data); +                image.src = currentUrl; +            }; + +            ws.onclose = function(event) { +                console.log("WebSocket closed:", event); +            }; + +            ws.onerror = function(event) { +                console.log("WebSocket error:", event); +            }; + +            window.addEventListener('beforeunload', function() { +                ws.close(); +            }); +        </script> +    </body> +</html> | 
