YouTip LogoYouTip

Prop Audio Error

HTML DOM Audio error Property

HTML DOM Audio error Property

Audio error Property

Audio Object Reference Audio Object

Example

Get the error state of the audio:

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 state of the audio/video.

Note: This property is read-only.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

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.

Audio Object Reference Audio Object

← Prop Audio LoopProp Audio Ended β†’