Skip to content

Commit

Permalink
feat(xgplayer):format code
Browse files Browse the repository at this point in the history
  • Loading branch information
hongqx committed Jul 19, 2023
1 parent 15f1cf1 commit 433f10a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
12 changes: 4 additions & 8 deletions packages/xgplayer/src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,9 @@ class Player extends MediaProxy {
}
this.hasStart = true
this.setState(STATES.ATTACHED)
Util.setTimeout(
this,
() => {
this.emit(Events.COMPLETE)
},
0
)
Util.setTimeout(this, () => {
this.emit(Events.COMPLETE)
}, 0)
}

/**
Expand Down Expand Up @@ -1267,7 +1263,7 @@ class Player extends MediaProxy {
this.once(Events.SEEKED, () => {
const playPromise = this.mediaPlay()
if (playPromise && playPromise.catch) {
playPromise.catch((err) => {
playPromise.catch(err => {
console.log(err)
})
}
Expand Down
4 changes: 2 additions & 2 deletions packages/xgplayer/src/plugins/fpsDetect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class FpsDetect extends BasePlugin {
const curTime = media.currentTime
const buffered = media.buffered
let enoughBuffer = false
let bufs = []
const bufs = []
for (let i = 0; i < buffered.length; i++){
const start = buffered.start(i)
const end = buffered.end(i)
Expand All @@ -96,7 +96,7 @@ export default class FpsDetect extends BasePlugin {
}
}

_reset(){
_reset (){
this._payload = []
this._currentStuckCount = 0
}
Expand Down
3 changes: 2 additions & 1 deletion packages/xgplayer/src/plugins/mobile/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ class Touche {
this.__clearPress()
root.removeEventListener(this.events.cancel, this.onTouchCancel)
root.removeEventListener(this.events.end, this.onTouchEnd)
root.removeEventListener(this.events.move, this.onTouchMove) e.moving = _pos.moving
root.removeEventListener(this.events.move, this.onTouchMove)
e.moving = _pos.moving
e.press = _pos.press
_pos.press && this.trigger(EVENTS.PRESS_END, e)
this.trigger(EVENTS.TOUCH_END, e)
Expand Down

0 comments on commit 433f10a

Please sign in to comment.