JAVASCRIPT: alternate way to get a duration of the embed file?

Is there anyway or javascript class or function that I can used to get the duration on the embed file?

I know we can do it like this

<!DOCTYPE html> 

<button onclick="myFunction()" type="button">Get video length</button><br>

<video id="myVideo" width="320" height="176" controls>
  <source src="mov_bbb.mp4" type="video/mp4">
  <source src="mov_bbb.ogg" type="video/ogg">
  Your browser does not support HTML5 video.

var vid = document.getElementById("myVideo");

function myFunction() { 

<p>Video courtesy of <a href="" target="_blank">Big Buck Bunny</a>.</p>


it only works on some supported browsers but not in ie8 below. Can anyone guide me how can I get the duration of the embed files? that can work on any crossbrowsers? or do I need to make a parser? please help thank you.

Source: javascript

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.