Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Video readyState Property

Video readyState property

Video Object Reference The Video object

Example

Get the readiness state of the video:

var x = document.getElementById("myVideo").readyState;

document.getElementById("demo").innerHTML = x;

x The output result is:

4 // Indicates that there is enough data to start playing

Try it »


Definition and Usage

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

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

Note: This property is read-only


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the readyState property

Note: Internet Explorer 8 or earlier browsers do not support this attribute.


Syntax

videoObject

.readyState

Return Value

Type Description
Digit

Represents the readiness state of the audio/video element:

  • 0 = HAVE_NOTHING - No information about whether the audio/video is ready
  • 1 = HAVE_METADATA - Metadata about the readiness of the audio/video
  • 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 - enough data is available to start playing
  • |

    Video Object Reference The Video object