X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Audio readyState Property

Audio Object Reference Audio Object

Example

Get the current ready state of the audio:

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

The result of x could be:

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

Try it yourself »


Definition and Usage

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

The ready state indicates if the audio is ready to play or not.

Note: This property is read-only.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The readyState property is supported in all major browsers.

Note: This property is not supported in Internet Explorer 8 and earlier.


Syntax

audioObject.readyState

Return Value

Type Description
Number Represents the ready state of the audio element:
  • 0 = HAVE_NOTHING - no information whether or not the audio is ready
  • 1 = HAVE_METADATA - metadata for the audio is ready
  • 2 = HAVE_CURRENT_DATA - data for the current playback position is available, but not enough data to play 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 available to start playing


Audio Object Reference Audio Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook