HTML onloadedmetadata Attribute
Last Updated :
10 Aug, 2021
The HTML onloadedmetadata Attribute is a event attribute which occurs when metadata is loaded for the specified audio/video.
Supported Tags:
Syntax:
<element onloadedmetadata="myScript">
Attribute Value: This attribute contains single value script which works when onloadedmetadata event attribute call. This attribute is supported by <audio> and <video> tags.
Example:
html
<!DOCTYPE html>
< html >
< head >
< title >
HTML onloadedmetadata Attribute
</ title >
</ head >
< body >
< center >
< h1 style = "color:green" >
GeeksforGeeks
</ h1 >
< h2 >
HTML onloadedmetadata Attribute
</ h2 >
< audio controls id = "audioId" >
</ audio >
< script >
document.getElementById(
"audioId").addEventListener(
"loadedmetadata", GFGFun);
function GFGFun() {
alert("Metadata is loaded");
}
</ script >
</ center >
</ body >
</ html >
|
Output:
Before:
After:
Supported Browsers:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera
Share your thoughts in the comments
Please Login to comment...