Reading duration of a video

Reading duration of a video

Hi all,

I'm developing a site where in i am adding videos as below:

<div class="container">
    <h1>jQuery WMBox Plugin Demos</h1>
        <a class="wmBox" href="#" data-popup="videos/v1.mp4">
<img src='images/v1.png' />
</a>
        <a class="wmBox" href="#" data-popup="videos/v2.mp4">
<img src='images/v2.png' />
</a>
</div>

How can i get the duration of the video in jquery.

I tried the below javascript functionality

$(document).ready(function(){
$('a[href]').each(function(){
       var data= $(this).attr('data-popup').duration;
      console.log(data)
});
});

But i am getting undefined. Kindly request anyone to help me in sorting the issue.