日期:2014-05-16  浏览次数:20428 次

请问如何用 windows media player 插件获取当前播放时间?
以前有做过,现在忘记在哪里了格式如:[00:03.09]。
代码是这样的:
JScript code

<SCRIPT LANGUAGE = "JScript"  FOR = Player EVENT = playStateChange(NewState)>
// Test for the player current state, display a message for each.
switch (NewState){
  case 1:
     myText.value = "Stopped";
     break;
   case 2:
     myText.value = "Paused";
     break;
  case 3:
     myText.value = "Playing";
     break;
}
</SCRIPT>



如何在状态为 Playing 的时候获取当前播放时间?

------解决方案--------------------
Player.CurrentPosition
Player.Duration
Player.currentMedia.duration
各个试试看
------解决方案--------------------

HTML code

<object width="300" height="150" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="mp1">
    <param name="FileName" value="http://www.sexq.com.cn/uploadfiles/tdskylbyy2008/2009-4/200942811212147.wma">
             <param name="AutoStart" value="1"/>
             <param name="ShowControls" value="1" />
             <param name="AutoSize" value="0" />            
             <param name="Mute" value="0">            
</object>
<input type=button onclick="getstate()" value="state">
<script type="text/javascript">
      function getstate(){
              var state=document.mp1.PlayState;
              var time=document.mp1.CurrentPosition
              alert(state+'  '+time);
          }
            
</script>