Audio errorProperty

Audio 对象参考手册Audio Object

Example

Get the audio error status:

var x = document.getElementById("myAudio").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

Currently, only Internet Explorer browser supports the error property.

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


Syntax

audioObject.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:

  • 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 - The audio/video is not supported


Audio 对象参考手册Audio Object Other Extensions