How to use the clappr.PlayerError.Levels function in clappr

To help you get started, we’ve selected a few clappr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clappr / dash-shaka-playback / src / clappr-dash-shaka-playback.js View on Github external
_onError (err) {
    const error = {
      shakaError: err,
      videoError: this.el.error

    let { category, code, severity } = error.shakaError.detail || error.shakaError

    if (error.videoError || !code && !category) return super._onError()

    const isCritical = severity === shaka.util.Error.Severity.CRITICAL
    const errorData = {
      code: `${category}_${code}`,
      description: `Category: ${category}, code: ${code}, severity: ${severity}`,
      level: isCritical ? PlayerError.Levels.FATAL : PlayerError.Levels.WARN,
      raw: err
    const formattedError = this.createError(errorData)
    Log.error('Shaka error event:', formattedError)
    this.trigger(Events.PLAYBACK_ERROR, formattedError)