<html>
<audio  controls>
  <source src="http://cdn.kaishuhezi.com/audio/story/M-1-01-20150408.mp3" type="audio/mpeg">
</audio>

<script>
        window.onload=function(){
      //do something
       var duration = document.getElementById("audio").duration;
        //alert(audio.duration);
        console.log(formatTime(parseInt(duration)));
        }

    function formatTime(second) {
          return [parseInt(second / 60 % 60), second % 60].join(":").replace(/\b(\d)\b/g, "0$1");
    }
</script>

    </html> 


相关文章:

  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-02-06
  • 2022-12-23
  • 2021-05-25
  • 2021-10-10
猜你喜欢
  • 2021-10-28
  • 2021-06-28
  • 2021-06-16
  • 2022-01-15
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
相关资源
相似解决方案