fix: 🐛 (xgplayer) 修复播放器seeked时,播放器未启动播放而弹幕自动播放问题

This commit is contained in:
gemstone 2024-10-12 15:13:36 +08:00
parent b13e8dd596
commit 95b73461e1

View File

@ -117,15 +117,16 @@ class Danmu extends Plugin {
this.intervalId = null
}
const now = window.performance.now()
if (now - this.seekCost > MIN_INTERVAL) {
const delayTime = now - this.seekCost > MIN_INTERVAL ? 100 : MIN_INTERVAL
this.intervalId = Util.setTimeout(this, () => {
this.danmujs.start()
} else {
this.intervalId = Util.setTimeout(this, () => {
this.danmujs.start()
// clearTimeout(this.intervalId)
this.intervalId = null
}, MIN_INTERVAL)
}
this.intervalId = null
if (this.player.paused) {
this.danmujs.pause()
}
}, delayTime)
})
}