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

Error

Player emits error event to notify user


import { Events } from 'xgplayer'

player.on(Events.ERROR, (error) => {
  // TODO
})

// OR

player.on('error', (error) => {
  // TODO
})

error

const error = {
  playerVersion: string,  // Player version
  errorType: string, // Error type
  errorCode: number, // Error Code
  message: string, // Error message
  mediaError?: { // Error from MediaElement
    code: number,
    message?: string
  },
  originError?: {},  // Origin error object
  readyState: number,  // MediaElement.readyState
  networkState: number,// MediaElement.networkState
  currentTime: number, // MediaElement.currentTime
  duration: number, // MediaElement.duration
  ended: boolean, // MediaElement.ended
  src: any, // MediaElement.src
  url?: string, // Only appears in network error
  httpCode?: number // Only appears in network error
}

type

Error typeDescription
mediaRequest to media resource was interrupted by user
networkRequest to media resource caused network error
decoderDecoding error
formatFormat of media resource is not supported by Platform
demuxError occurs in demuxing process
remuxError occurs in remuxing process
hlsError occurs in HLS parsing process or content recognition failed
mseError from MediaSource

code

Error codeDescriptionError typeRemark
5101Request to media resource was interrupted by usermediav3.0.2+
5102Request to media resource caused network errornetworkv3.0.2+
5103Decoding errordecoderv3.0.2+
5104Format of media resource is not supported by Platformformatv3.0.2+
5105current browser can`t decode videoformatv3.0.2+
5106src emptyformatv3.0.2+
1Request to media resource was interrupted by usermediav3.0.2+Deprecated
2Request to media resource caused network errornetworkv3.0.2+Deprecated
3Decoding errordecoderv3.0.2+Deprecated
4Format of media resource is not supported by Platformformatv3.0.2+Deprecated
600HTTP request failed due to CDN or resource issues, you can get error code from httpCodenetwork
601HTTP request timeoutnetwork
602HTTP request failed due to network or CORS issuesnetwork
603Other request errors caused by StreamReader or Fetch APInetwork
700Error occurs in demuxing processdemux
800Error occurs in remuxing processremux
900Error occurs in HLS parsing processhls
901M3u8 content recognition failedhls
1000Error occurs when invoking addSourceBuffermse