Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <video width="320" height="240" id = "myVideo" controls>
  2. <source src="someVideo.mp4" type="video/mp4">
  3. Your browser does not support the video tag.
  4. </video>
  5.  
  6. <script>
  7. var e = document.getElementById("myVideo");
  8. var cancelAlert = false;
  9. var run = function() {
  10. if (e.readyState === 4 && !cancelAlert) {//readyState 4 means it is loaded fully
  11. cancelAlert = true;//This is so that it only alerts once. No spam pls.
  12. alert(e.duration);
  13. }
  14. requestAnimationFrame(run);//This is so that it runs every frame.
  15. };
  16. run();//run the function
  17. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement