js 獲取視頻的總時長


js 獲取視頻的總時長:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>

<video id="videoPlayerNew" src="http://vfx.mtime.cn/Video/2019/03/18/mp4/190318231014076505.mp4" controls="controls">
your browser does not support the video tag
</video>
</body>
<script type="text/javascript">
    var vid = document.getElementById("videoPlayerNew");
        vid.onloadedmetadata = function() {
              console.log('metadata loaded!');
              console.log(vid.duration); //打印時長
        };
</script>
</html>

轉自:https://stackoverflow.com/questions/40763057/trying-to-get-full-video-duration-but-returning-as-nan


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM