Video error attribute

Definition and usage

error The property returns a MediaError object.

The MediaError object provides a code property that contains the video error state.

Note:This property is read-only.

Example

Get the video error state:

var x = document.getElementById("myVideo").error.code;

Try it yourself

Syntax

videoObject.error.code

Return value

Type Description
Number

The code property of the MediaError object returns a number representing the video error state:

  • 1 = MEDIA_ERR_ABORTED - The process was aborted by the user
  • 2 = MEDIA_ERR_NETWORK - Error occurred during download
  • 3 = MEDIA_ERR_DECODE - Error occurred during decoding
  • 4 = MEDIA_ERR_SRC_NOT_SUPPORTED - Video is not supported

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Not Supported 9.0 Not Supported Not Supported Not Supported