فهرست منبع

视频继续播放

y595705120 20 ساعت پیش
والد
کامیت
95a29848f8
1فایلهای تغییر یافته به همراه8 افزوده شده و 4 حذف شده
  1. 8 4
      src/containers/center/play/play.vue

+ 8 - 4
src/containers/center/play/play.vue

@@ -232,14 +232,18 @@
       },
       },
       handleVisibilityChange() {
       handleVisibilityChange() {
         if (document.hidden) {
         if (document.hidden) {
-          this.enterPiP()
           let myPlayer = this.$refs.videoPlayer && this.$refs.videoPlayer.player
           let myPlayer = this.$refs.videoPlayer && this.$refs.videoPlayer.player
           if (myPlayer && myPlayer.currentTime) {
           if (myPlayer && myPlayer.currentTime) {
             this.hiddenStartTime = Date.now()
             this.hiddenStartTime = Date.now()
             this.hiddenBasePosition = myPlayer.currentTime() || 0
             this.hiddenBasePosition = myPlayer.currentTime() || 0
           }
           }
-        } else {
-          this.exitPiP()
+        } else if (this.hiddenStartTime) {
+          let elapsed = (Date.now() - this.hiddenStartTime) / 1000
+          let estimated = this.hiddenBasePosition + elapsed
+          this.hiddenStartTime = 0
+          if (estimated < (this.media.duration || Infinity)) {
+            this.setposition(estimated)
+          }
         }
         }
       },
       },
       onEnterPiP() {
       onEnterPiP() {
@@ -451,7 +455,7 @@
         return 0
         return 0
       },
       },
       tick(force = false) {
       tick(force = false) {
-        console.log("tick")
+        console.log("tick", this.tickNum)
         let media = this.media;
         let media = this.media;
         this.tickNum++
         this.tickNum++
         if (this.media.isFinish) {
         if (this.media.isFinish) {