Fix for montage view camera freezes
Posted: Wed Sep 09, 2009 11:39 am
When a stream socket is closed on the server, the picture freezes. The patch installs an onLoad listener for each camera in montage view and launches a checker. The latter examines the latest load time for each picture and re-queries the stream, if necessary.
Code: Select all
diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js
index 9852f6d..4c5fae8 100644
--- a/web/skins/classic/views/js/montage.js
+++ b/web/skins/classic/views/js/montage.js
@@ -114,14 +114,54 @@ function changeScale()
}
}
+function reloadFrame(index)
+{
+ var streamImg = document.getElementById( 'liveStream'+monitors[index].id );
+ var imgSrc = streamImg.getAttribute("src");
+ var newImgSrc = imgSrc.substring(0, imgSrc.length - 1);
+ newImgSrc = newImgSrc + Math.floor(10*Math.random());
+ streamImg.setAttribute("src", newImgSrc);
+}
+
+var checkRun = 0;
+
+function checkFrame()
+{
+ var d = new Date();
+ var t = d.getTime();
+ for ( var i = 0; i <monitorData> 2500) {
+ reloadFrame(i);
+ }
+ }
+ catch (e) {
+ if (++checkRun < 3)
+ alert(e);
+ }
+ }
+}
+
+function onFrameLoad(index)
+{
+ var d = new Date();
+ monitors[index].loadStamp = d.getTime();
+ $('loadStamp' + index).set( 'text', d.toLocaleTimeString());
+}
+
var monitors = new Array();
function initPage()
{
+ setInterval("checkFrame()", 1000);
+ var f;
for ( var i = 0; i <monitorData>
- <div><SLANG>: <span></span> - <span></span> fps</div>
+ <div><SLANG>: <span></span> - <span></span> fps - <span></span></div>
<php>