谢杰标 2 роки тому
батько
коміт
f6e5069c1c
1 змінених файлів з 28 додано та 19 видалено
  1. 28 19
      pages3/polyv/detail.vue

+ 28 - 19
pages3/polyv/detail.vue

@@ -894,7 +894,7 @@ export default {
       popupPhotoShow: false,
       curPlayIndex: 0, // 正在播放的节的下标
       // h5
-      vodPlayerJs: "https://player.polyv.net/script/player.js",
+      vodPlayerJs: "https://player.polyv.net/resp/vod-player/latest/player.js",
       player: "",
       H5isAllowSeek: "on",
       // stream: null,
@@ -1293,12 +1293,17 @@ export default {
     },
     clearPauseTimer() {
       if (this.pauseTimer) {
-        console.log(this.pauseTimer, "清除定时器");
         this.pauseTime = 0;
         clearInterval(this.pauseTimer);
         this.pauseTimer = null;
       }
     },
+    clearBarTimer(){
+      if (this.barTimer) {
+        clearInterval(this.barTimer);
+        this.barTimer = null;
+      }
+    },
     // 原来onUnload里面的内容
     originUnload() {
       if (this.playSectionId > 0 && this.hasStart) {
@@ -1321,10 +1326,7 @@ export default {
         this.hasStart = false;
       }
       this.clearPauseTimer();
-      if (this.barTimer) {
-        clearInterval(this.barTimer);
-        this.barTimer = null;
-      }
+      this.clearBarTimer()
       this.timer && clearInterval(this.timer);
       if (this.lockTimer) {
         clearInterval(this.lockTimer);
@@ -2621,6 +2623,7 @@ export default {
       } else {
         this.vid = item.recordingUrl;
       }
+      console.log(79798)
       this.recordObj = null;
       this.recordObj = await this.getRecordLast();
       this.needSeek = true; //跳转到播放记录
@@ -2929,6 +2932,15 @@ export default {
                 uni.$emit("playNext" + playNextId); //通知播放结束
               }
               self.ossAvatarUrl = "";
+            } else if (code == 600) {
+              uni.showModal({
+                showCancel: false,
+                title: "提示",
+                content: res.data.msg,
+                success: (resultst) => {
+                  uni.navigateBack();
+                },
+              });
             } else {
               this.uploadLock = false;
               uni.showToast({
@@ -3623,7 +3635,7 @@ export default {
             self.autoplay = true;
             // #endif
           }
-          if (self.goodsPlayConfig.drag > 0) {
+          if (self.goodsPlayConfig.drag > 0 && !self.erJianErZao) {
             // #ifdef MP-WEIXIN
             self.isAllowSeek = "yes";
             // #endif
@@ -3631,6 +3643,7 @@ export default {
             self.H5isAllowSeek = "off";
             // #endif
           }
+
           if (self.goodsPlayConfig.speed > 0) {
             self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
           }
@@ -3832,6 +3845,7 @@ export default {
     loadPlayer() {
       const polyvPlayer = window.polyvPlayer;
       this.$api.polyvVideoSign(this.vid).then(async (res) => {
+        console.log(this.vid,res.data.data.ts,res.data.data.sign)
         this.player = await polyvPlayer({
           wrap: "#player",
           width: "100%",
@@ -3850,43 +3864,38 @@ export default {
           ts: res.data.data.ts, // 移动播放加密视频需传入的时间戳。
           sign: res.data.data.sign, // 移动端播放加密视频所需的签名
         });
-
         polyvPlayerContext = this.player;
-
         this.player.on("s2j_onPlayStart", async (vid) => {
           // 视频初次播放时触发
           console.log("视频初次播放时触发:");
           // #ifdef H5
           // h5禁止拖动进度条
-          clearInterval(this.barTimer);
-          this.barTimer = null;
+          this.clearBarTimer()
           let originTime = this.recordObj.videoCurrentTime || 0;
-          if (
-            (this.H5isAllowSeek == "on" || this.erJianErZao) &&
-            !this.barTimer
-          ) {
-            this.barTimer = setInterval(function () {
+          if (this.H5isAllowSeek == "on") {
+            this.barTimer = setInterval(()=>{ 
               const currentTime = polyvPlayerContext.j2s_getCurrentTime();
+              console.log(currentTime, originTime, 789);
               if (
-                currentTime - originTime > 1 ||
+                currentTime - originTime > 15 ||
                 currentTime - originTime < 0
               ) {
                 polyvPlayerContext.j2s_seekVideo(originTime);
               } else {
                 originTime = currentTime;
               }
-            }, 500);
+            }, 2000);
           }
           // #endif
           this.loadedmetadata();
           this.postStudyRecord(0);
         });
-
         this.player.on("s2j_onVideoPause", () => {
           // 视频暂停时触发
           console.log("视频暂停时触发", this.vid);
           this.erJianErZaoPauseTip();
 
+          this.clearBarTimer()
           clearInterval(this.studyTimer);
           clearInterval(this.timer);
         });