HTML Audio/Video DOM readyState attribute

Instance

Get the ready state of the video:

myVid=document.getElementById("video1");
alert(myVid.readyState);

Try It Yourself

Definition and Usage

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

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

Browser Support

All major browsers support the readyState property.

Note:Internet Explorer 8 and earlier browsers do not support this property.

Syntax

audio|video.readyState

Return value

Type Description
Numeric value

Represents the readiness state of the audio/video element:

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