HTML Audio/Video DOMreadyStateProperty

HTML audio/video 标签参考手册HTML Audio/Video DOM Reference

Examples

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 ready state of the audio/video.

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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

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 for 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


HTML audio/video 标签参考手册HTML Audio/Video DOM Reference Other Extensions