Video errorProperty

Video 对象参考手册Video Object

Examples

Get the video's error status:

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

Try it Yourself »

Definition and Usage

The error property returns a MediaError object.

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

Note:This property is read-only.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Only 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 that represents the error status of the audio/video:

  • 1 = MEDIA_ERR_ABORTED - The fetch 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


Video 对象参考手册Video Object Other extensions