Audio readyStateProperty
Example
Get the ready state of the audio:
var x = document.getElementById("myAudio").readyState;
document.getElementById("demo").innerHTML = x;
document.getElementById("demo").innerHTML = x;
xOutput result:
4 // indicates there is enough data to start playing the audio
Try it yourself »
Definition and Usage
The readyState property returns the current ready state of the audio.
The ready state indicates whether the audio is ready to play.
Note:This property is read-only.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the readyState property.
Note:Internet Explorer 8 and earlier IE versions do not support this property.
Syntax
audioObject.readyState
Return Value
| Type | Description |
|---|---|
| Numeric value |
Indicates the ready state of the audio element:
|
Audio Object
Other extensions