Browse Source

调整前端实时检测的频率

Michael Wang 6 năm trước cách đây
mục cha
commit
3f941f5f4e
1 tập tin đã thay đổi với 8 bổ sung5 xóa
  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) &&
         !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);
     },
   },
 };