欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

利用JAVASCRIPT控制MEDIA PLAYER的功能实现

程序员文章站 2022-06-26 08:37:51
var volv=phx.settings.volume;...
<script language=javascript defer>
var volv=phx.settings.volume;
setinterval("if(phx.playstate==3){time.innertext=phx.controls.currentpositionstring+\'|\'+
phx.currentmedia.durationstring}",1000);
setinterval("if(phx.playstate==3){itcn.style.width=parseint(245*(phx.controls.currentposition/phx.currentmedia.duration))}",1000);
function volup(){
if (volv<100){
volv+=5;
phx.settings.volume=volv;
time.innertext=volv;}
else{time.innertext=\'最大\';}
}
function voldown(){
if (volv>0){
volv-=5;
phx.settings.volume=volv;
time.innertext=volv;}
else{time.innertext=\'最小\';}
}
</script>
<p> 
<object classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" id="phx" width="245" height="240">
<param name="url" value="http://www.wfzx.net/wf-phx/music/she_superstar.wmv">
<param name="rate" value="1">
<param name="balance" value="0">
<param name="currentposition" value="0">
<param name="defaultframe" value>
<param name="playcount" value="1">
<param name="autostart" value="-1">
<param name="currentmarker" value="0">
<param name="invokeurls" value="-1">
<param name="baseurl" value>
<param name="volume" value="50">
<param name="mute" value="0">
<param name="uimode" value="full">
<param name="stretchtofit" value="0">
<param name="windowlessvideo" value="0">
<param name="enabled" value="-1">
<param name="enablecontextmenu" value="-1">
<param name="fullscreen" value="0">
<param name="samistyle" value>
<param name="samilang" value>
<param name="samifilename" value>
<param name="captioningid" value>
<param name="enableerrordialogs" value="0">
<param name="_cx" value="6482">
<param name="_cy" value="6350">
</object>
</p>
<input type=button value=mute onclick=phx.settings.mute=phx.settings.mute==true?false:true;time.innertext=phx.settings.mute==true?\'静音\':\'关闭静音\';>
<input type=button value=play onclick=phx.controls.play();time.innertext=\'播放\';>
<input type=button value=pause onclick=phx.controls.pause();time.innertext=\'暂停\';>
<input type=button value=stop onclick=phx.controls.stop();time.innertext=\'停止\';>
<input type=button value=mode onclick=phx.settings.balance=phx.settings.balance==\'100\'?\'-100\':\'100\';time.innertext=phx.settings.balance==\'100\'?\'右声道\':\'左声道\';>
<input type=button value=vol++ onclick=volup();>
<input type=button value=vol-- onclick=voldown();>
<input type=button value=fullscreen onclick="if(phx.playstate==3)phx.fullscreen=1;">
<br>
<div id="time" style="background:#f2f3f7;width:245">正在加载媒体。。。</div>
<table id=bar style="width:245;height:10px;border:1px black solid;">
<tr> 
<td id=itcn bgcolor=#f70968 style="width:0"></td>
<td id=bar2 style="width:245"></td>
</tr>
</table>