HTML Audio/Video DOMloadeddataEvents

HTML Audio/Video DOM Reference Manual

Example

Indicates that the data for the current frame is available:

myVid=document.getElementById("video1");
myVid.onloadeddata=alert("Browser has loaded the current frame");

Try it Yourself »

Definition and Usage

The loadeddata event occurs when data for the current frame has been loaded, but there is not enough data to play the next frame of the specified audio/video.

When the audio/video is in the process of loading, the following events occur in sequence:

  1. loadstart
  2. durationchange
  3. loadedmetadata
  4. loadeddata
  5. progress
  6. canplay
  7. canplaythrough

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the loadeddata event.

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


Syntax

In HTML:

<audio|video onloadeddata="SomeJavaScriptCode">

In JavaScript:

audio|video.onloadeddata=SomeJavaScriptCode;

Using addEventListener():

audio|video.addEventListener("loadeddata", function()
  {
  //SomeJavaScriptCode
  }
);

Technical Details

The following HTML tags are supported: <audio>, <video>
The following JavaScript objects are supported: Audio, Video


实例

More Examples

Using the onloadeddata attribute on HTML elements

Using addEventListener() to listen for the loadeddata event


HTML Audio/Video DOM Reference Manualother extensions