HTML Audio/Video DOM error attribute

Example

Obtaining the error status of the video:

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

Try It Yourself

Definition and Usage

The error attribute returns a MediaError object.

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

Browser Support

Only Internet Explorer 9 supports the error attribute.

Syntax

audio|video.error.code

Return Value

Type Description
Numeric Value

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

  • 1 = MEDIA_ERR_ABORTED - The retrieval process is aborted by the user
  • 2 = MEDIA_ERR_NETWORK - Error occurs during download
  • 3 = MEDIA_ERR_DECODE - Error occurs during decoding
  • 4 = MEDIA_ERR_SRC_NOT_SUPPORTED - Audio/video is not supported