onloadeddata-händelse

Definition and usage

The onloadeddata event occurs when the current frame's data is loaded, but there is not enough data to play the next frame of the specified audio/video.

The following events occur in the following order during the loading process of audio/video:

  1. onloadstart
  2. ondurationchange
  3. onloadedmetadata
  4. onloadeddata
  5. onprogress
  6. oncanplay
  7. oncanplaythrough

Example

Example 1

Execute JavaScript when data in the current frame is available (for <video>):

<video onloadeddata="myFunction()">

Try it yourself

Example 2

Execute JavaScript when data in the current frame is available (for <audio>):

<audio onloadeddata="myFunction()">

Try it yourself

Syntax

In HTML:

<element onloadeddata="myScript">

Try it yourself

In JavaScript:

object.onloadeddata = function(){myScript};

Try it yourself

In JavaScript, use the addEventListener() method:

object.addEventListener("loadeddata", myScript);

Try it yourself

Note:Internet Explorer 8 or earlier versions do not support addEventListener() method.

Technical details

Bubbling: Not supported
Cancellable: Not supported
Event type: Event
Supported HTML tags: <audio> och <video>
DOM Version: Level 3 Events

Browser Support

The numbers in the table indicate the first browser version that fully supports this incident.

Incident Chrome IE Firefox Safari Opera
onloadeddata Stöd 9.0 Stöd Stöd Stöd