y595705120 21 часов назад
Родитель
Сommit
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() {
         if (document.hidden) {
-          this.enterPiP()
           let myPlayer = this.$refs.videoPlayer && this.$refs.videoPlayer.player
           if (myPlayer && myPlayer.currentTime) {
             this.hiddenStartTime = Date.now()
             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() {
@@ -451,7 +455,7 @@
         return 0
       },
       tick(force = false) {
-        console.log("tick")
+        console.log("tick", this.tickNum)
         let media = this.media;
         this.tickNum++
         if (this.media.isFinish) {