English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML Audio/Video DOM loadeddata Event

The loadeddata event is triggered after the first frame of data is loaded.

 Manuale di riferimento DOM Audio/Video HTML

Online Example

Hint that the data of the current frame is available:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/Video loadeddata Event Usage - Basic Tutorial (oldtoolbag.com)</title>
<head>
<body>
<video id="video1" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the HTML5 video tag.
</video>
<script>
myVid=document.getElementById("video1");
myVid.onloadeddata=alert("Browser has loaded the current frame");
</script> 
</body>
</html>
Test to see </>

Definition and usage

A loadeddata event will occur when the data of 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 loading process, the following events will occur in turn:

Browser compatibility

IEFirefoxOperaChromeSafari

Tutti i browser mainstream supportano l'evento loadeddata.

Attenzione:Internet Explorer 8 e le versioni precedenti non supportano questo evento.

Sintassi

In HTML:

<audio|video onloadeddata="SomeJavaScriptCode">

In JavaScript:

audio|video.onloadeddata=SomeJavaScriptCode;

Usa addEventListener():

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

Dettagli tecnici

Le seguenti etichette HTML supportano:<audio>, <video>
I seguenti oggetti JavaScript supportano:Audio, Video

Più esempi

Usa l'attributo onloadeddata sugli elementi HTML

Usa addEventListener() per ascoltare l'evento loadeddata

 Manuale di riferimento DOM Audio/Video HTML