HTML | DOM onloadedmetadata Event
The onloadedmetadata event in HTML occurs when metadata is loaded for the specified audio/video.
Events that occur during the loading process of an audio/video:
- onloadstart
- ondurationchange
- onloadedmetadata
- onloadeddata
- onprogress
- oncanplay
- oncanplaythrough
Syntax:
- In HTML:
<element onloadedmetadata="myScript">
- In JavaScript:
object.onloadedmetadata = function(){myScript}; - In JavaScript, using the addEventListener() method:
object.addEventListener("loadedmetadata", myScript);
Example: In JavaScript, using the addEventListener() method
<!DOCTYPE html> <html> <head> <title> HTML DOM onloadeddata Event </title> </head> <body> <center> <h1 style="color:green"> GeeksforGeeks </h1> <h2> HTML DOM onloadedmetadata Event </h2> <video controls id="VideoId"> <source src= type="video/mp4"> </video> <script> document.getElementById( "VideoId").addEventListener( "loadedmetadata", GFGFun); function GFGFun() { alert("Metadata loaded"); } </script> </center> </body> </html> |
chevron_right
filter_none
Output


Supported Browsers: The browsers supported by HTML DOM onloadedmetadata Event are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Recommended Posts:
- HTML | DOM ondragend Event
- HTML | DOM ondblclick Event
- HTML | DOM ondragenter Event
- HTML | DOM oncopy Event
- HTML | DOM oncut Event
- HTML | DOM onscroll Event
- HTML | DOM ondragstart Event
- HTML | DOM onsearch Event
- HTML | DOM onpaste Event
- HTML | DOM onfocus Event
- HTML | DOM ondurationchange Event
- HTML | DOM ondrop Event
- HTML | DOM onseeked Event
- HTML | DOM onloadstart Event
- HTML | DOM ondragover Event
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



