فهرست منبع

旧版本没有此摄像头api

Michael Wang 5 سال پیش
والد
کامیت
e82896ac29
1فایلهای تغییر یافته به همراه12 افزوده شده و 6 حذف شده
  1. 12 6
      src/components/FaceRecognition/FaceRecognition.vue

+ 12 - 6
src/components/FaceRecognition/FaceRecognition.vue

@@ -123,12 +123,18 @@ export default {
             },
           });
           if (stream) {
-            const vt0 = stream.getVideoTracks()[0];
-            console.log({
-              getCapabilities: vt0.getCapabilities && vt0.getCapabilities(),
-              getConstraints: vt0.getConstraints && vt0.getConstraints(),
-              getSettings: vt0.getSettings && vt0.getSettings(),
-            });
+            {
+              const vt0 = stream.getVideoTracks()[0];
+              if (vt0.getCapabilities && vt0.getCapabilities) {
+                console.log({
+                  getCapabilities: vt0.getCapabilities && vt0.getCapabilities(),
+                  getConstraints: vt0.getConstraints && vt0.getConstraints(),
+                  getSettings: vt0.getSettings && vt0.getSettings(),
+                });
+              } else {
+                console.log("stream.getVideoTracks()[0] failed");
+              }
+            }
             video.srcObject = stream;
             window.__stream = stream;
             try {