Horje

How to alert when the meta data of the video has loaded

Play Video

index.html
Example: HTML
<!DOCTYPE html> 
<html> 
<body> 

<script>
function myFunction() {
  alert('Metadata for video loaded');
}
</script>

<video controls onloadedmetadata="myFunction()">
  <source src="https://file-examples.com/index.php/sample-video-files/sample-mp4-files/" type="video/mp4">
  <source src="https://file-examples.com/index.php/sample-video-files/sample-mp4-files/" type="video/ogg">
  Your browser does not support HTML5 video.
</video>

<p>Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>

</body> 
</html>

Output should be:

How to alert when the meta data of the video has loaded




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Media Events Attribute
Uploaded by:
Admin