]> www.vanbest.org Git - motioneye-debian/commitdiff
added a checker for camera errors that get stuck on loading
authorCalin Crisan <ccrisan@gmail.com>
Sun, 1 Dec 2013 13:13:27 +0000 (15:13 +0200)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 1 Dec 2013 13:13:27 +0000 (15:13 +0200)
src/handlers.py
static/js/main.js

index b285aa29a9ea95fe96ae0df12c55be77239908e6..ef4daed97a9a5c6bebe8b646739f5fa43bc82eb0 100644 (file)
@@ -629,6 +629,9 @@ class PictureHandler(BaseHandler):
         if camera_id not in config.get_camera_ids():
             raise HTTPError(404, 'no such camera')
         
+        import time
+        time.sleep(100)
+        
         camera_config = config.get_camera(camera_id)
         if camera_config['@proto'] != 'v4l2':
             def on_response(response):
index df7be01d371685ba27465d8a40f9f13a1055a9b0..c48a7aeec74fce01512f97cead68d3a96fbc0baa 100644 (file)
@@ -1904,6 +1904,20 @@ function refreshCameraFrames() {
     setTimeout(refreshCameraFrames, 100);
 }
 
+function checkCameraErrors() {
+    /* properly triggers the onerror event on the cameras whose imgs were not successfully loaded,
+     * but the onerror event hasn't been triggered, for some reason (seems to happen in Chrome) */
+    var cameraFrames = $('div.page-container').find('img.camera');
+    
+    cameraFrames.each(function () {
+        if (this.complete === true && this.naturalWidth === 0 && !this.error) {
+            $(this).error();
+        }
+    });
+    
+    setTimeout(checkCameraErrors, 500);
+}
+
 
     /* startup function */
 
@@ -1935,5 +1949,6 @@ $(document).ready(function () {
     initUI();
     fetchCurrentConfig();
     refreshCameraFrames();
+    checkCameraErrors();
 });