Skip to content

Commit

Permalink
修复切换视频源后error插件不消失的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lison16 committed Dec 19, 2019
1 parent 600bade commit b237a56
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/xgplayer/src/control/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ let error = function () {
}
player.on('error', errorFunc)

function destroyFunc () {
player.off('error', errorFunc)
player.off('destroy', destroyFunc)
function onCanplay () {
util.removeClass(player.root, 'xgplayer-is-error')
}
player.once('destroy', destroyFunc)
player.on('canplay', onCanplay)
player.on('error', onError)
function onDestroy () {
player.off('error', onError)
player.off('destroy', onDestroy)
player.off('canplay', onCanplay)
}
player.once('destroy', onDestroy)
}

Player.install('error', error)

0 comments on commit b237a56

Please sign in to comment.