HTML onloadeddata Event Attribute

Description

The event attribute onloadeddata occurs when data for the current frame is loaded, but this data is not enough to play the next frame of the specified audio / video file.

In the process of downloading audio / video, events occur in the following order:

Syntax

<element onloadeddata="script">

Values

  • scriptThe name of the script to use when the event has been triggered.

Example

<!DOCTYPE HTML>
<html>
<body>

<audio id="myAudio" controls onloadeddata="myFunction()">  
  <source src="audio.mp3" type="audio/mpeg">
  Your browser does not support the audio tag.
</audio>

<p>Play audio file:</p>

<script>
function myFunction() {
    alert("Data uploaded");
}
</script> 

<p>This example shows how to use the onloadeddata attribute for an AUDIO element.</p>

</body>
</html>

Supported Tags

<audio> and <video>

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
XXYes3.5XX
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
YesYes4XXX