Skip to content

Commit

Permalink
fix(xgplayer): onTimeupdate中AUTOPLAY_STARTED的触发增加判断为this.state === ST…
Browse files Browse the repository at this point in the history
…ATES.NOTALLOW; 2. startTime处理放在onLoadedData中,修复ios中在durationchange修改currentTime之后timeupdate不触发问题
  • Loading branch information
hongqx committed May 15, 2024
1 parent cc80615 commit 849541d
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/xgplayer/src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1854,18 +1854,15 @@ class Player extends MediaProxy {
this.waitTimer && Util.clearTimeout(this, this.waitTimer)
}

onDurationchange () {
onLoadeddata () {
this.isError = false
this.isSeeking = false
if (this.__startTime > 0 && this.duration > 0) {
this.currentTime = this.__startTime
this.__startTime = -1
}
}

onLoadeddata () {
this.isError = false
this.isSeeking = false
}

onLoadstart () {
this.removeClass(STATE_CLASS.ERROR)
this.isCanplay = false
Expand Down Expand Up @@ -1988,7 +1985,7 @@ class Player extends MediaProxy {
}

// 兼容safari在调整为静音之后未调用play自动起播问题
if (!this.paused && this.state < STATES.RUNNING && this.duration) {
if (!this.paused && this.state === STATES.NOTALLOW && this.duration) {
this.setState(STATES.RUNNING)
this.emit(Events.AUTOPLAY_STARTED)
}
Expand Down

0 comments on commit 849541d

Please sign in to comment.