Skip to content

Commit

Permalink
fix: 🐛 (xgplayer) 修复播放器seeked时,播放器未启动播放而弹幕自动播放问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gemxx committed Oct 12, 2024
1 parent b13e8dd commit 95b7346
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/xgplayer/src/plugins/danmu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

Expand Down

0 comments on commit 95b7346

Please sign in to comment.