Execute a JavaScript when meta data for an audio is loaded: - Javascript DOM Event

Javascript examples for DOM Event:onloadedmetadata

Description

Execute a JavaScript when meta data for an audio is loaded:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<audio controls onloadedmetadata="myFunction()">
  <source src="your.ogg" type="audio/ogg">
  <source src="your.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>/*ww w. ja v  a2 s.c  om*/

<script>
function myFunction() {
    console.log("Meta data for audio loaded");
}
</script>

</body>
</html>

Related Tutorials