Video readyStateProperty

Video 对象参考手册Video Object

Examples

Get the video's ready state:

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

xThe output is:

4 // indicates there is enough data to start playing

Try it Yourself »

Definition and Usage

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

The ready 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 property.


Syntax

videoObject.readyState

Return Value

Type Description
Number

Indicates the ready state of the audio/video element:

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


Video 对象参考手册Video Object Other Extensions