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

HTML Audio/Video DOM readyState Property

HTML Audio/Video DOM readyState Property

HTML audio/video Tag Reference HTML Audio/Video DOM Reference

Example

Get the readiness state of the video:

myVid=document.getElementById("video1");

alert(myVid.readyState);

Try it »


Definition and Usage

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

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


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the readyState attribute.

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


Syntax

audio|video

.readyState

Return Value

Type Description
Number Represents the readiness state of the audio/video (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
  • |

    HTML audio/video Tag Reference HTML Audio/Video DOM Reference