Skip to content

Commit

Permalink
fix(xgplayer): 修复seek状态下切换播放源时间不更新问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hongqx committed Dec 11, 2023
1 parent 3dfe347 commit 3a4dfab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/xgplayer/src/plugins/progress/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ class Progress extends Plugin {
*/
onTimeupdate (isEnded) {
const { player, _state, offsetDuration } = this
if (player.isSeeking || this.isProgressMoving) {
if ((player.isSeeking && player.media.seeking) || this.isProgressMoving || !player.hasStart) {
return
}
if (_state.now > -1) {
Expand Down
7 changes: 5 additions & 2 deletions packages/xgplayer/src/plugins/time/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ class Time extends Plugin {
}
this.durationDom = this.find('.time-duration')
this.timeDom = this.find('.time-current')
this.on([Events.DURATION_CHANGE, Events.SEEKED, Events.TIME_UPDATE], () => {
this.on([Events.DURATION_CHANGE, Events.SEEKED, Events.TIME_UPDATE], (e) => {
if (e.eventName === 'durationchange') {
this.isActiving = false
}
this.onTimeUpdate()
})

Expand Down Expand Up @@ -187,7 +190,7 @@ class Time extends Plugin {
this.isActiving = false
}
this.off(Events.SEEKED, updateState)
if (player.isSeeking) {
if (player.isSeeking && player.media.seeking) {
this.once(Events.SEEKED, updateState)
} else {
this.isActiving = false
Expand Down

0 comments on commit 3a4dfab

Please sign in to comment.