该页面通过WebSocket连接到服务器,并请求不断变化的广播网络摄像头框架:
<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>
在常规Chrome浏览器中,在Firefox和IE图像中,即使没有Preload
- 只有Screen.src = URL.createObjectURL(event.data)
,也会像视频一样平滑变化。
在客户坚持的Chromium 61版中,框架在加载时闪烁!
是否有可能在Chromium 61中修复此闪烁?