Audio readyState attribute
Example
Get the ready state of the audio:
var x = document.getElementById("myAudio").readyState;
document.getElementById("demo").innerHTML = x;
x Output result:
4 // indicates there is enough data to start playing the audio
Try it »
Definition and Usage
The readyState attribute returns the current ready state of the audio.
The ready state indicates whether the audio is ready to play.
Note: This attribute is read-only.
Browser support





All major browsers support the readyState attribute.
Note: Internet Explorer 8 and earlier IE versions do not support this attribute.
Syntax
audioObject
.readyState
Return Value
| Type | Description |
|---|---|
| Numeric value |
Represents the ready state of the audio element: |
Audio object