<video style="display:none;" controls="controls" id="aa" oncanplaythrough="myFunction(this)"></video>
<input type="file" οnchange="changeFile(this)" >
<script>
    function myFunction(ele) {
     //视频时长 单位秒 alert(Math
.floor(ele.duration)); } function changeFile(ele){ var video = ele.files[0]; var url = URL.createObjectURL(video); console.log(url); document.getElementById("aa").src=url; } </script>

js实现视频本地预览,以及获取播放时长

 

相关文章:

  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2021-07-13
相关资源
相似解决方案