OpenTV Player Web HTML5

Class: MediaError

MediaError

new MediaError(value)

A Custom MediaError class which mimics the standard HTML5 MediaError class.

Name Type Description
value number | string | Object | MediaError

This can be of multiple types: - number: should be a standard error code - string: an error message (the code will be 0) - Object: arbitrary properties - MediaError (native): used to populate a video.js MediaError object - MediaError (video.js): will return itself if it's already a video.js MediaError object.

See:

Members

static,constant MediaError.defaultMessagesArray

The default MediaError messages based on the MediaError.errorTypes.

static,readonly MediaError.errorTypesarray

Errors indexed by the W3C standard. The order CANNOT CHANGE! See the specification listed under MediaError for more information.

Properties:
Name Type Description
0 string

MEDIA_ERR_CUSTOM

1 string

MEDIA_ERR_ABORTED

2 string

MEDIA_ERR_NETWORK

3 string

MEDIA_ERR_DECODE

4 string

MEDIA_ERR_SRC_NOT_SUPPORTED

5 string

MEDIA_ERR_ENCRYPTED

static,constant MediaError.MEDIA_ERR_ABORTEDnumber

W3C error code for media error aborted.

Default Value:
  • 1

static,constant MediaError.MEDIA_ERR_CUSTOMnumber

W3C error code for any custom error.

Default Value:
  • 0

static,constant MediaError.MEDIA_ERR_DECODEnumber

W3C error code for any decoding error.

Default Value:
  • 3

static,constant MediaError.MEDIA_ERR_ENCRYPTEDnumber

W3C error code for any time that a source is encrypted.

Default Value:
  • 5

static,constant MediaError.MEDIA_ERR_NETWORKnumber

W3C error code for any network error.

Default Value:
  • 2

static,constant MediaError.MEDIA_ERR_SRC_NOT_SUPPORTEDnumber

W3C error code for any time that a source is not supported.

Default Value:
  • 4

codeNumber

The error code that refers two one of the defined MediaError types

constant MEDIA_ERR_ABORTEDnumber

W3C error code for media error aborted.

Default Value:
  • 1

constant MEDIA_ERR_CUSTOMnumber

W3C error code for any custom error.

Default Value:
  • 0

constant MEDIA_ERR_DECODEnumber

W3C error code for any decoding error.

Default Value:
  • 3

constant MEDIA_ERR_ENCRYPTEDnumber

W3C error code for any time that a source is encrypted.

Default Value:
  • 5

constant MEDIA_ERR_NETWORKnumber

W3C error code for any network error.

Default Value:
  • 2

constant MEDIA_ERR_SRC_NOT_SUPPORTEDnumber

W3C error code for any time that a source is not supported.

Default Value:
  • 4

messageString

An optional message that to show with the error. Message is not part of the HTML5 video spec but allows for more informative custom errors.

metadata

An optional object to give more detail about the error. This can be used to give a higher level of specificity to an error versus the more generic MediaError codes. metadata expects an errorType string that should align with the values from videojs.Error.

statusArray

An optional status code that can be set by plugins to allow even more detail about the error. For example a plugin might provide a specific HTTP status code and an error message for that code. Then when the plugin gets that error this class will know how to display an error message for it. This allows a custom message to show up on the Player error overlay.