如何从音频播放器获取currentTime?

时间:2015-10-09 09:08:44

标签: jquery html5 mediaelement.js

我使用mediaelement.js作为音频播放器。如何从玩家那里获得当前时间?

var player = new MediaElementPlayer('#player audio');
player.play();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelement-and-player.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/mediaelement/2.18.1/mediaelementplayer.min.css" rel="stylesheet" />

<div id="player">

  <audio type="audio/mp3" controls="controls">
    <Source src="http://mediaelementjs.com/media/AirReview-Landmarks-02-ChasingCorporate.mp3"></Source>
  </audio>

</div>

1 个答案:

答案 0 :(得分:0)

你可以在这里找到很多信息:

http://www.w3schools.com/tags/ref_av_dom.asp

player.currentTime;