HTML Audio/Video DOMloadedmetadataEvents
HTML Audio/Video DOM Reference Manual
Example
Indicates that the video's metadata has been loaded:
myVid=document.getElementById("video1");
myVid.onloadedmetadata=alert("Meta data for video loaded");
myVid.onloadedmetadata=alert("Meta data for video loaded");
Try it Yourself »
Definition and Usage
The loadedmetadata event occurs when the metadata for the specified audio/video has been loaded.
The metadata for audio/video includes: duration, dimensions (video only), and text tracks.
When the audio/video is in the process of loading, the following events occur in sequence:
- loadstart
- durationchange
- loadedmetadata
- loadeddata
- progress
- canplay
- canplaythrough
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the loadedmetadata event.
Note:Internet Explorer 8 and earlier versions do not support this event.
Syntax
In HTML:
<audio|video onloadedmetadata="SomeJavaScriptCode">
In JavaScript:
audio|video.onloadedmetadata=SomeJavaScriptCode;
Using addEventListener():
audio|video.addEventListener("loadedmetadata", function()
{
//SomeJavaScriptCode
}
);
{
//SomeJavaScriptCode
}
);
Technical Details
| The following HTML tags are supported: | <audio>, <video> |
|---|---|
| The following JavaScript objects are supported: | Audio, Video |

More Examples
Using the onloadedmetadata attribute on HTML elements
Use addEventListener() to listen for the loadedmetadata event
HTML Audio/Video DOM Reference Manualother extensions