浏览代码

调整前端实时检测的频率

Michael Wang 6 年之前
父节点
当前提交
3f941f5f4e
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8 5
      src/features/OnlineExam/Examing/FaceTracking.vue

+ 8 - 5
src/features/OnlineExam/Examing/FaceTracking.vue

@@ -184,13 +184,16 @@ export default {
         (!result || result.length !== 1) &&
         (!result || result.length !== 1) &&
         !videoEl.classList.contains("video-warning")
         !videoEl.classList.contains("video-warning")
       ) {
       ) {
-        videoEl.classList.add("video-warning");
-        this.warningTimeout = setTimeout(function() {
-          videoEl.classList.remove("video-warning");
-        }, 3000);
+        this.findFirst = !this.findFirst; // 两次才告警
+        if (!this.findFirst) {
+          videoEl.classList.add("video-warning");
+          this.warningTimeout = setTimeout(function() {
+            videoEl.classList.remove("video-warning");
+          }, 3000);
+        }
       }
       }
 
 
-      this.detectFacesTimeout = setTimeout(() => this.detectFaces(), 5000);
+      this.detectFacesTimeout = setTimeout(() => this.detectFaces(), 10 * 1000);
     },
     },
   },
   },
 };
 };