xuqiaoying 2 anni fa
parent
commit
ec86c99c8c
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      pages3/polyv/detail.vue

+ 4 - 2
pages3/polyv/detail.vue

@@ -539,6 +539,7 @@
               <!-- #endif -->
               <!-- #ifdef H5 -->
               <video id="video" :src="stream" width="400" height="300" class="photo_v"></video>
+              <canvas class="canvas" canvas-id="canvas"></canvas>
               <!-- #endif -->
             </view>
             <view class="custom" v-if="!isTaking">
@@ -3153,12 +3154,13 @@ export default {
       // #endif
       // #ifdef H5
       console.log('===确认拍照:', document);
-      const canvas = document.createElement("canvas");
+      // const canvas = document.createElement("canvas");
+      const canvas = uni.createCanvasContext("canvas")
       console.log('canvas:', canvas);
       canvas.width = 400;
       canvas.height = 300;
       const context = canvas.getContext("2d");
-      const video = document.getElementById("video");
+      const video = uni.createVideoContext('video')
       console.log('canvas->video', video, document);
       context.drawImage(video, 0, 0, 400, 300);
       this.faceUrl = canvas.toDataURL("image/png");