HTML DOM Video readyState Property

HTMLWeb DevelopmentFront End Technology

The HTML DOM Video readyState property returns a number corresponding to the current ready state of the video.


Following is the syntax −

Returning number value


Here, the return value can be the following −

  • 0 (HAVE_NOTHING) depicts no information available
  • 1 (HAVE_METADATA) depicts metadata for the media is ready and video is seekable
  • 2 (HAVE_CURRENT_DATA) depicts data for the current playback position is available, but not enough data to play next frame
  • 3 (HAVE_FUTURE_DATA) depicts data for the current position and also for at least more than two frames of video
  • 4 (HAVE_ENOUGH_DATA) depicts enough data available to start playing

Let us see an example of HTML DOM Video readyState property −


Live Demo

<!DOCTYPE html>
<title>HTML DOM Video readyState</title>
   * {
      padding: 2px;
   form {
      margin: 0 auto;
      text-align: center;
   input[type="button"] {
      border-radius: 10px;
         <video id="demo" width="320" controls><source src="" type="video/mp4"></video><br>
         <input type="button" onclick="setTrackDetails()" value="Set Source">
         <input type="button" onclick="getTrackDetails()" value="Get ready State">
         <div id="divDisplay">
      var divDisplay = document.getElementById("divDisplay");
      var demo = document.getElementById("demo");
      var srcOfMedia = '';
      function getTrackDetails() {
         divDisplay.textContent = 'ready State: '+demo.readyState;
      function setTrackDetails() {
         demo.src = srcOfMedia;


Clicking ‘Get ready State’ button with no source defined −

Clicking ‘Get ready State’ button with source defined −

Published on 31-Oct-2019 06:10:24