English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML Audio/Video DOM readyState property

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

 HTML Audio/Video DOM Reference Manual

Online Example

Get the video readiness state:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/Video readyState property usage-Basic Tutorial(oldtoolbag.com)</title>
</head>
<body>
<button onclick="getReadyState()" type="button">Get the video readiness state</button>
<br> 
<video id="video1" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support HTML5 video tag.
</video>
<script>
myVid = document.getElementById("video1");
function getReadyState()
{ 
  alert(myVid.readyState);
} 
</script>  
</body>
</html>
Test and see ‹/›

Definition and usage

The readyState property returns the audio/The current ready state of the video.
Ready state indicates audio/Whether the video is ready to play.
Note: This property is read-only.

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the readyState property.

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

Syntax

audio|video.readyState

Return value

TypeDescription
NumberRepresents audio/Video (audio/Ready state of the (audio) element:
  • 0 = HAVE_NOTHING - No information about audio/Information about whether the video is ready

  • 1 = HAVE_METADATA - About audio/Metadata of video ready

  • 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 - Data for the current and at least the next frame is available

  • 4 = HAVE_ENOUGH_DATA - Data available is sufficient to start playback

 HTML Audio/Video DOM Reference Manual