Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Video error Property

Video error property

Video Object Reference The Video object

Example

Get the error state of the video:

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

Try it »


Definition and Usage

The error attribute returns a MediaError object.

The code attribute of the MediaError object contains the error status of the audio/video.

Note: This attribute is read-only.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Only the Internet Explorer browser supports the error property.

Note: Internet Explorer 8 and earlier IE versions do not support this element.


Syntax

videoObject

.error.code

Return Value

Type Description
Numeric value

The code property of the MediaError object returns a numeric value representing the error state of the audio/video:

  • 1 = MEDIA_ERR_ABORTED - the retrieval process was aborted by the user
  • 2 = MEDIA_ERR_NETWORK - an error occurred during download
  • 3 = MEDIA_ERR_DECODE - an error occurred during decoding
  • 4 = MEDIA_ERR_SRC_NOT_SUPPORTED - audio/video not supported
  • |

    Video Object Reference The Video object