xuqiaoying 2 жил өмнө
parent
commit
56706cbc47

+ 6 - 5
pages2/class/questionBank.vue

@@ -3018,11 +3018,12 @@ export default {
       console.log("有摄像头---", stream);
       this.photoPopup = true;
       this.isTaking = true;
-
-      const video = document.querySelector("video");
-      console.log('video:', video);
-      video.srcObject = stream;
-      video.play();
+      this.$nextTick(() => {
+        const video = document.querySelector("video");
+        console.log('video:', video);
+        video.srcObject = stream;
+        video.play();
+      })
     },
     photographError(err) {
       console.log("没有摄像头:", err);

+ 6 - 4
pages3/live/detail.vue

@@ -2561,10 +2561,12 @@ export default {
       this.isTaking = true;
       this.enableAutoRotation = false;
 
-      const video = document.querySelector("video");
-      console.log('video:', video);
-      video.srcObject = stream;
-      video.play();
+      this.$nextTick(() => {
+        const video = document.querySelector("video");
+        console.log('video:', video);
+        video.srcObject = stream;
+        video.play();
+      })
     },
     photographError(err) {
       console.log("没有摄像头:", err);

+ 6 - 6
pages3/polyv/detail.vue

@@ -957,8 +957,6 @@ export default {
     }
   },
   onShow() {
-    // this.photoPopup = true;
-    // this.isTaking = true;
 
     if (this.$method.isGoLogin()) {
       // 从公众号消息进来的没登录需要跳到登录页,登录后返回
@@ -3865,10 +3863,12 @@ export default {
       this.isTaking = true;
       this.enableAutoRotation = false;
 
-      const video = document.querySelector("video");
-      console.log('video:', video);
-      video.srcObject = stream;
-      video.play();
+      this.$nextTick(() => {
+        const video = document.querySelector("video");
+        console.log('video:', video);
+        video.srcObject = stream;
+        video.play();
+      })
     },
     photographError(err) {
       console.log("没有摄像头:", err);