xuqiaoying 2 gadi atpakaļ
vecāks
revīzija
1c49439cf1
1 mainītis faili ar 24 papildinājumiem un 12 dzēšanām
  1. 24 12
      pages3/polyv/detail.vue

+ 24 - 12
pages3/polyv/detail.vue

@@ -538,13 +538,17 @@
               </camera>
               <!-- #endif -->
               <!-- #ifdef H5 -->
-              <!-- <img v-show="!isTaking" :src="faceUrl" alt="" /> -->
               <video id="video" :src="stream" class="photo_v"></video>
               <!-- #endif -->
             </view>
-            <view class="custom" v-if="!isTaking"
-              ><image :src="avatarUrl" mode=""></image
-            ></view>
+            <view class="custom" v-if="!isTaking">
+              <!-- #ifdef MP-WEIXIN -->
+              <image :src="avatarUrl" mode=""></image>
+              <!-- #endif -->
+              <!-- #ifdef H5 -->
+              <image :src="faceUrl" mode="" ></image>
+              <!-- #endif -->
+          </view>
           </view>
           <view class="btns">
             <!-- <view class="btnResult" v-if="isTaking" @click="takePhoto"
@@ -799,6 +803,7 @@ export default {
       H5isAllowSeek: 'off',
       stream: null,
       mediaStreamTrack: '',
+      faceUrl: "",
     };
   },
   computed: {
@@ -2710,6 +2715,7 @@ export default {
           let photoTime = 0; //获取拍照秒数
           for (let i = 0; i < this.photoList.length; i++) {
             photoTime = Number(this.photoList[i]); //获取拍照秒数
+            console.log('photoTime:', photoTime, 'this.sectionItem.learning', this.sectionItem.learning);
             if (photoTime < this.playTime && photoTime > this.playTime - 8) {
               //3秒区间内才触发拍照,避免拉动滚动条
               if (
@@ -2728,9 +2734,12 @@ export default {
                 polyvPlayerContext.toggleFullscreen()
                 // #endif
                 this.photoIndex = i;
+                console.log('i:i', i);
                 if (uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) == this.goodsId) {
+                  console.log('2222');
                 this.openPhoto();
                 } else {
+                  console.log('1111');
                   this.popupPhotoShow = true
                   uni.setStorageSync(`tabkePhotoShow${this.goodsId}`, this.goodsId) // 本地缓存用来判断是否已经弹出过弹窗
                 }
@@ -3105,6 +3114,7 @@ export default {
       // #endif
       // #ifdef H5
       const canvas = document.createElement("canvas");
+      console.log('canvas:', canvas);
       canvas.width = 400;
       canvas.height = 300;
       const context = canvas.getContext("2d");
@@ -3112,6 +3122,7 @@ export default {
       context.drawImage(video, 0, 0, 400, 300);
       this.faceUrl = canvas.toDataURL("image/png");
       this.isTaking = false;
+      console.log('this.faceUrl:', this.faceUrl);
       // #endif
     },
     playError(e) {
@@ -3414,11 +3425,12 @@ export default {
           watchStartTime: this.recordObj.videoCurrentTime, // 播放开始时间,表示视频从第几秒开始播放,参数值需小于视频时长
           ts: res.data.data.ts, // 移动播放加密视频需传入的时间戳。
           sign: res.data.data.sign, // 移动端播放加密视频所需的签名
-          // playsafe: (vid, next) => { // PC端播放加密视频所需的授权凭证
-          //   this.$api.obtainpolyvvideopcsign(vid).then((res) => {
-          //     next(res.data);
-          //   });
-          // },
+          playsafe: (vid, next) => { // PC端播放加密视频所需的授权凭证
+            next();
+            // this.$api.obtainpolyvvideopcsign(vid).then((res) => {
+            //   next(res.data);
+            // });
+          },
         });
 
         polyvPlayerContext = this.player
@@ -3431,7 +3443,7 @@ export default {
         });
 
         this.player.on("s2j_onVideoPause", () => { // 视频暂停时触发
-          console.log('视频暂停时触发');
+          console.log('视频暂停时触发', this.vid);
           clearInterval(this.studyTimer)
           clearInterval(this.timer)
         })
@@ -3540,11 +3552,11 @@ export default {
       this.$nextTick(() => {
         const video = document.getElementById("video");
         // 将视频流设置为video元素的源
-        console.log('video1:',video);
+        console.log('video1:',video, stream);
         video.srcObject = stream;
         this.mediaStreamTrack =
           typeof stream.stop === "function" ? stream : stream.getTracks()[0];
-        video.play();
+        // video.play();
       });
     },
     photographError(err) {