西瓜播放器 HTML5 video video.js 播放器 HTML5播放器 mp4 hls hls.js flv flv.js dash dash.js 无缝切换

error

The error prompt layer displayed when there is an error in playback。SourceCode

pluginName: error

hooks

errorRetry

在错误面板展示的时候,用户点击【刷新】的时候执行,具体使用方式如下

// Called by player instance
player.usePluginHooks('error', 'errorRetry', (plugin, ...args) =>{
  // TODO
})

// Called by plugin instance
player.getPlugin('error').useHooks('errorRetry', (plugin, ...args) =>{
  // TODO
   /**
   * 如果返回false,不会执行默认的重试逻辑
   * If true is returned, the default retry logic will be executed to reload the current playback address
   * */
})

showError

在播放器触发error事件,错误面板展示之前执行, 具体使用方式如下

// Called by player instance
player.usePluginHooks('error', 'showError', (plugin, ...args) =>{
  // TODO
})

// Called by plugin instance
player.getPlugin('error').useHooks('showError', (plugin, ...args) =>{
  // TODO
  /**
   * If false is returned, the error prompt panel will not be displayed
   * If it returns true, the error panel will be displayed according to the default logic
   * */
})