HTML Audio/Video DOMerrorProperty

HTML Audio/Video DOM Reference Manual

Example

Get the video's error status.

myVid=document.getElementById("video1");
alert(myVid.error.code);

Try it Yourself »

Definition and Usage

error property returns a MediaError object.

The code property of the MediaError object contains the error state of the audio/video.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Only Internet Explorer 9 supports the error property.


Syntax

audio|video.error.code

Return Value

Type Description
Number The code property of the MediaError object returns a numeric value that represents the error state of the audio/video:
  • 1 = MEDIA_ERR_ABORTED - The fetching process was aborted by the user.
  • 2 = MEDIA_ERR_NETWORK - An error occurred when downloading.
  • 3 = MEDIA_ERR_DECODE - An error occurred when decoding.
  • 4 = MEDIA_ERR_SRC_NOT_SUPPORTED - audio/video not supported


HTML Audio/Video DOM Reference Manualother extensions