The page connects via WebSocket to the server and requests a constantly changing frame of the broadcasting web camera:
<script>
function Initialize(){
var Screen = document.createElement('img');
Screen.onload = function(){URL.revokeObjectURL(Screen.src);};
document.body.appendChild(Screen);
var Rate = 50;
var Preload = new Image();
var Request = 'GetFrame';
var Socket = new WebSocket(<?php echo $host;?>);
Socket.onopen = function(){Socket.send(Request);};
Socket.onmessage = function(event){
if (Preload.src.length > 0){Screen.src = Preload.src;}
Preload.src = URL.createObjectURL(event.data);
setTimeout(function(){Socket.send(Request);},Rate);
};
}
</script>
...
<body onload="Initialize();"></body>
In regular Chrome, in Firefox and IE images change smoothly like video, even without Preload
- just Screen.src = URL.createObjectURL(event.data)
.
And in Chromium version 61, which customers insist on, the frames blink on loading!
Is it possible to fix this blinking in Chromium 61?