xuqiaoying 2 tahun lalu
induk
melakukan
cea3c11d9c
1 mengubah file dengan 28 tambahan dan 25 penghapusan
  1. 28 25
      pages3/polyv/detail.vue

+ 28 - 25
pages3/polyv/detail.vue

@@ -957,6 +957,32 @@ export default {
     }
   },
   onShow() {
+    // this.photoPopup = true;
+    // this.isTaking = true;
+    // if (
+    //   (window.navigator.mediaDevices &&
+    //     window.navigator.mediaDevices.getUserMedia) ||
+    //   window.navigator.getUserMedia ||
+    //   window.navigator.webkitGetUserMedia ||
+    //   window.navigator.mozGetUserMedia
+    // ) {
+    //   console.log("getUserMedia----");
+    //   // 调用用户媒体设备, 访问摄像头
+    //   this.getUserMedia(
+    //     {
+    //       video: {
+    //         width: 400,
+    //         height: 300,
+    //       },
+    //     },
+    //     this.photographSuccess,
+    //     this.photographError
+    //   );
+    // } else {
+    //   console.log("1111没有摄像");
+    //   this.photographError();
+    // }
+
     if (this.$method.isGoLogin()) {
       // 从公众号消息进来的没登录需要跳到登录页,登录后返回
       return;
@@ -3174,25 +3200,6 @@ export default {
       });
       // #endif
       // #ifdef H5
-      console.log(
-        "photoPopup:",
-        this.photoPopup,
-        "isTaking:",
-        this.isTaking,
-        "window:",
-        window,
-        "navigator:",
-        navigator
-      );
-      console.log(
-        "window.navigator.mediaDevices",
-        navigator.mediaDevices,
-        navigator.mediaDevices.getUserMedia,
-        navigator.getUserMedia,
-        navigator.webkitGetUserMedia,
-        navigator.mozGetUserMedia
-      );
-      // this.$nextTick(() => {
       if (
         (window.navigator.mediaDevices &&
           window.navigator.mediaDevices.getUserMedia) ||
@@ -3216,9 +3223,7 @@ export default {
         console.log("1111没有摄像");
         this.photographError();
       }
-      // })
       // #endif
-      console.log("拍照结束");
     },
     /**
      * 人脸匹配
@@ -3845,11 +3850,9 @@ export default {
       }
     },
     photographSuccess(stream) {
-      console.log("有摄像头---");
-      // 兼容webkit核心浏览器
-      // this.isTaking = true
-      // this.photoPopup = true
+      console.log("有摄像头---", stream);
       const video = document.querySelector("video");
+      console.log('video:', video);
       video.srcObject = stream;
       video.play();
     },