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
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/92057.html
標籤:JavaScript
上一篇:ES6-10筆記(let&const -- Array)
下一篇:a標簽拖拽 href地址禁止顯示
