Skip to content

Commit 95b7346

Browse files
committed
fix: 🐛 (xgplayer) 修复播放器seeked时,播放器未启动播放而弹幕自动播放问题
1 parent b13e8dd commit 95b7346

File tree

1 file changed

+9
-8
lines changed
  • packages/xgplayer/src/plugins/danmu

1 file changed

+9
-8
lines changed

packages/xgplayer/src/plugins/danmu/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,16 @@ class Danmu extends Plugin {
117117
this.intervalId = null
118118
}
119119
const now = window.performance.now()
120-
if (now - this.seekCost > MIN_INTERVAL) {
120+
const delayTime = now - this.seekCost > MIN_INTERVAL ? 100 : MIN_INTERVAL
121+
122+
this.intervalId = Util.setTimeout(this, () => {
121123
this.danmujs.start()
122-
} else {
123-
this.intervalId = Util.setTimeout(this, () => {
124-
this.danmujs.start()
125-
// clearTimeout(this.intervalId)
126-
this.intervalId = null
127-
}, MIN_INTERVAL)
128-
}
124+
this.intervalId = null
125+
126+
if (this.player.paused) {
127+
this.danmujs.pause()
128+
}
129+
}, delayTime)
129130
})
130131
}
131132

0 commit comments

Comments
 (0)