HTML DOM Audio error Property
Audio error Property
Example
Get the error state of the audio:
var x = document.getElementById("myAudio").error.code;
Definition and Usage
The error property returns a MediaError object.
The code property of the MediaError object contains the error state of the audio/video.
Note: This property is read-only.
Browser Support
The error property is currently only supported by Internet Explorer.
Note: Internet Explorer 8 and earlier versions do not support this property.
Syntax
audioObject.error.code
Return Value
| Type | Description |
|---|---|
| Number | The code property of the MediaError object returns a number value that represents the error state of the audio:* 1 = MEDIA_ERR_ABORTED - The fetching process was aborted by the user agent. * 2 = MEDIA_ERR_NETWORK - An error occurred while downloading the media resource. * 3 = MEDIA_ERR_DECODE - An error occurred while decoding the media resource. * 4 = MEDIA_ERR_SRC_NOT_SUPPORTED - The media resource is not supported. |
YouTip