|
|
@@ -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) {
|