Audio readyState attribute

Definition and usage

readyState The property returns the current readiness state of the audio.

The readiness state indicates whether the audio is ready to play.

Note:This property is read-only.

Example

Get the current readiness state of the audio:

var x = document.getElementById("myAudio").readyState;
document.getElementById("demo").innerHTML = x;

Try it yourself

Syntax

audioObject.readyState

Return value

Type Description
Number

Indicates the readiness state of the audio element:

  • 0 = HAVE_NOTHING - No information is available about whether the audio is ready
  • 1 = HAVE_METADATA - The metadata of the audio is ready
  • 2 = HAVE_CURRENT_DATA - Data at the current playback position is available, but there is not enough data to play the next frame/millisecond
  • 3 = HAVE_FUTURE_DATA - Current and at least the next frame of data is available
  • 4 = HAVE_ENOUGH_DATA - There is enough available data to start playback

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support