http://www.w3school./html5/html_5_video_dom.asp
The duration attribute is only available after the video's metadata has been loaded.
2. Video loading event processing
The oncanplaythrough event is executed when the video can be played normally without pause.
/jsref/
3. JS code example
<html>
<body>
<video controls oncanplaythrough="myFunction()">
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video elements.
</source></source></video>
<p ><p>
<script>
var a=("aa");
function myFunction() {
("demo").innerHTML="Video duration: "++"seconds";
}
</script>
</body>
</html>
4、jQueryCode
<video oncanplaythrough="myFunction()" src="" controls>
</video><br>
<p >111</p>
<script>
function myFunction() {
var a=$("#videoplay").attr("duration");
$("#demo").text("Video duration: "+a+"second");
}
</script>