谢杰标 před 2 roky
rodič
revize
ddbb9c06ff
2 změnil soubory, kde provedl 12 přidání a 111 odebrání
  1. 8 0
      components/myPlayer/polyvPlayer.vue
  2. 4 111
      pages3/polyv/detail.vue

+ 8 - 0
components/myPlayer/polyvPlayer.vue

@@ -159,6 +159,14 @@ export default {
         this.Elevideo.addEventListener("timeupdate", this.timeupdate);
       // #endif
     },
+    resumeVideo() {
+      // #ifdef MP-WEIXIN
+      polyvPlayerContext.play();
+      // #endif
+      // #ifdef H5
+      polyvPlayerContext.j2s_resumeVideo();
+      // #endif
+    },
     playerError(err) {
       console.log("播放err", err);
     },

+ 4 - 111
pages3/polyv/detail.vue

@@ -29,20 +29,7 @@
           @loadedmetadata="loadedmetadata"
           @timeupdate="timeupdate"
         ></my-player>
-        <view
-          class="video_box"
-          style="width: 100%; height: 421rpx"
-          v-if="playChannelId > 0"
-        >
-          <player
-            class="plv-mp-demo-player"
-            :videoOption="videoOption"
-            :page-gesture="true"
-            :vslide-gesture="true"
-            :vslide-gesture-in-fullscreen="true"
-            @onLiveStatusChange="playerLiveStatusChange"
-          />
-        </view>
+      
       </view>
       <view class="course_name">
         <view class="course_titles">
@@ -767,17 +754,6 @@ export default {
       seekTime: "",
       toastTimer: null,
       videoToastShow: false,
-      initLiveOk: false,
-      livePlay: false, //是否正在播放直播,不含暂停
-      liveDuration: 0, //直播观看时长
-      videoOption: {
-        mode: "live",
-        uid: "",
-        cid: "",
-        openId: "",
-        isAutoChange: false,
-        forceVideo: false,
-      },
       showSet: false,
       startStatus: false,
       detail: {},
@@ -826,7 +802,6 @@ export default {
       isTaking: true, //是否正在拍照
       needSeek: false, //第一次播放是否需要跳转
       needProfileModal: false, //是否需要资料审核弹框
-      liveObj: {},
       photoNum: 0,
       photoList: [], //拍照的时间点
       photoConfig: false, //是否配置好拍照次数
@@ -861,11 +836,7 @@ export default {
       menuAllList: [],
       popupPhotoShow: false,
       curPlayIndex: 0, // 正在播放的节的下标
-      // h5
-      vodPlayerJs: "https://player.polyv.net/resp/vod-player/latest/player.js",
-      player: "",
       H5isAllowSeek: "on",
-      // stream: null,
       faceUrl: "",
       erJianErZao: false,
       pauseTime: 0,
@@ -941,6 +912,7 @@ export default {
     }
     this.option = option;
     let { skipPort, id, goodsId, orderGoodsId, gradeId, informId } = option;
+    console.log("🚀 ~ file: detail.vue:928 ~ onLoad ~ id:", option)
     if (skipPort) {
       await this.$method.skipLogin(skipPort);
     }
@@ -1439,12 +1411,7 @@ export default {
         this.noticeShow = false;
         if (this.handoutTipLength == 0 && this.goodsPlayConfig.autoPlay > 0) {
           this.autoplay = true;
-          // #ifdef MP-WEIXIN
-          polyvPlayerContext.play();
-          // #endif
-          // #ifdef H5
-          polyvPlayerContext.j2s_resumeVideo();
-          // #endif
+          this.$refPlv.resumeVideo()
         }
       }
     },
@@ -2039,59 +2006,6 @@ export default {
       }
       return photoList;
     },
-    getLiveUid(channelId) {
-      let self = this;
-      return new Promise((resolve) => {
-        let data = {
-          channelId: channelId,
-          orderGoodsId: this.orderGoodsId,
-        };
-        self.$api.polyvSign(data).then((res) => {
-          resolve(res.data.data);
-        });
-      });
-    },
-    timeEventLiving() {
-      if (plv != null) {
-        if (this.livePlay) {
-          this.liveDuration = this.liveDuration + 1; //每隔1秒
-          if (this.liveDuration == 2) {
-            //直播第2秒拍照
-            if (
-              this.goodsPhotographConfig &&
-              this.goodsPhotographConfig.livephotograph == 1 &&
-              this.channelItem.learning != 1 &&
-              this.photoHistoryList.length == 0
-            ) {
-              //开启直播拍照
-              this.openPhoto();
-            } else {
-              this.postStudyRecord(0);
-            }
-          }
-        }
-      }
-    },
-    playerLiveStatusChange(e) {
-      const status = e.detail.status;
-      if (status === "live") {
-        //开始播放
-        if (this.timer) {
-          clearInterval(this.timer);
-        }
-        this.livePlay = true;
-        this.timer = setInterval(this.timeEventLiving, 1000); //定时器
-      }
-      if (status === "end") {
-        this.hasStart = false;
-        if (this.livePlay) {
-          //只有播放过的结束才提交,避免未开播触发结束
-          this.postStudyRecord(1);
-        }
-        this.livePlay = false;
-        // 未开始
-      }
-    },
     closePlv() {
       if (plv) {
         plv.destroy();
@@ -2174,10 +2088,6 @@ export default {
       this.startStatus = true;
     },
     getRecordLast(sectionItem) {
-      console.log(
-        "🚀 ~ file: detail.vue:2244 ~ getRecordLast ~ sectionItem:",
-        sectionItem
-      );
       let { chapterId, sectionId, courseId, moduleId } = sectionItem;
       return new Promise((resolve) => {
         let data = {
@@ -2647,16 +2557,6 @@ export default {
       clearTimeout(this.toastTimer);
       this.videoToastShow = false;
     },
-    restart() {
-      // #ifdef MP-WEIXIN
-      polyvPlayerContext.seek(0);
-      // #endif
-      // #ifdef H5
-      polyvPlayerContext.j2s_seekVideo(0);
-      // #endif
-      clearTimeout(this.toastTimer);
-      this.videoToastShow = false;
-    },
     // 新增用户视频学习日志
     studyLog() {
       this.$http({
@@ -2972,14 +2872,7 @@ export default {
             this.photoPopup = false;
             this.uploadLock = false;
             this.enableAutoRotation = true;
-            if (polyvPlayerContext != null) {
-              // #ifdef MP-WEIXIN
-              polyvPlayerContext.play();
-              // #endif
-              // #ifdef H5
-              polyvPlayerContext.j2s_resumeVideo();
-              // #endif
-            }
+            this.$refPlv.resumeVideo()
           })
           .catch((err) => {
             console.log("拍照记录接口的err", err);