Using JavaScript to achieve control of media player

Source: Internet
Author: User
Tags object setinterval
javascript| Control <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= ' Max ';}
}
function Voldown () {
if (volv>0) {
volv-=5;
Phx.settings.volume=volv;
Time.innertext=volv;}
else{time.innertext= ' min ';}
}
</script>
<p>
<object classid= "Clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" id= "PHX" width= "245" height= ">"
<param name= "URL" value= " location of sound files/shengyin.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= "M" >
<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? ' Mute ': ' Turn off mute ';>
<input Type=button value=play onclick=phx.controls.play (); time.innertext= ' Play ';>
<input Type=button value=pause onclick=phx.controls.pause () time.innertext= ' suspend ';>
<input Type=button value=stop onclick=phx.controls.stop () time.innertext= ' Stop ';>
<input Type=button value=mode onclick=phx.settings.balance=phx.settings.balance== ' 100 '? -100 ': ' time.innertext=phx.settings.balance== ' 100 '? ' Right channel ': ' Left channel ';>
<input Type=button value=vol++ onclick=volup ();>
<input Type=button value=vol--onclick=voldown ();>
<input Type=button value=fullscreen >
<br>
<div id= "Time" style= "background: #f2f3f7; width:245" > Loading media ... </div>
<table id=bar style= "width:245;height:10px;border:1px black Solid;" >
<tr>
&LT;TD ID=ITCN bgcolor= #f70968 style= "width:0" ></td>
&LT;TD id=bar2 style= "width:245" ></td>
</tr>
</table>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.