Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <video width="320" height="240" id = "myVideo" controls>
- <source src="someVideo.mp4" type="video/mp4">
- Your browser does not support the video tag.
- </video>
- <script>
- var e = document.getElementById("myVideo");
- var cancelAlert = false;
- var run = function() {
- if (e.readyState === 4 && !cancelAlert) {//readyState 4 means it is loaded fully
- cancelAlert = true;//This is so that it only alerts once. No spam pls.
- alert(e.duration);
- }
- requestAnimationFrame(run);//This is so that it runs every frame.
- };
- run();//run the function
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement