Controlling the Wmplayer player in a Web page

Source: Internet
Author: User
Tags object
Control | Web page

Detailed parameters to query MSDN
Http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay/mmp_sdk/settingsobject.asp

<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<link href= "Style/style.css" rel= "stylesheet" type= "Text/css" >

<script language= "JavaScript" >
var state;

Class
function Playerinit ()
{
Player.url= "mp3.m3u";
Player.settings.autoStart = false;
}

Play
function Play ()
{
if (player.controls.isavailable (' play '))
{
Player.controls.play ();
State=setinterval ("UpdateTime ()", 1000);
playerinfo.innerhtml = "Play";
}
}

Time out
function Pause ()
{
if (player.controls.isavailable (' pause '))
{
Player.controls.pause ();
Clearinterval (state);
playerinfo.innerhtml = "Pause";
}
}

Stop it
function Stop ()
{
if (player.controls.isavailable (' Stop '))
{
Player.controls.stop ();
Clearinterval (state);
playerinfo.innerhtml = "Stop";
}
}

Former head
function Previous ()
{
if (player.controls.isavailable (' previous '))
{
Player.controls.previous ();
playerinfo.innerhtml = "the first one";
}
}

After the first
function Next ()
{
if (player.controls.isavailable (' Next '))
{
Player.controls.next ();
playerinfo.innerhtml = "Next song";
}
}


function Step ()
{
if (player.controls.isavailable (' Step '))
Player.controls.step (1);
}

Volume
function Voldown ()
{
if (Player.settings.volume < 5)
{
Player.settings.volume = 0;
playerinfo.innerhtml = "0";
}
Else
{
Player.settings.volume-= 5;
playerinfo.innerhtml = Player.settings.volume;
}
}

Volume +
function Volup ()
{
if (Player.settings.volume > 95)
{
Player.settings.volume = 100;
playerinfo.innerhtml = "100";
}
Else
{
Player.settings.volume + 5;
playerinfo.innerhtml = Player.settings.volume;
}
}

Mute
Function Mute ()
{
Player.settings.mute =!player.settings.mute;
}

Channel
function balance ()
{
Switch (player.settings.balance)
{
Case 0:
player.settings.balance = 100;
playerinfo.innerhtml = ' Left channel ';
Break
Case 100:
player.settings.balance =-100;
playerinfo.innerhtml = ' Right channel ';
Break
CASE-100:
player.settings.balance = 0;
playerinfo.innerhtml = ' Full channel ';
Break
Default:
player.settings.balance = 0;
playerinfo.innerhtml = ' Full channel ';
Break
}
}

Update Time
function UpdateTime ()
{
playerinfo.innerhtml = player.controls.currentPositionString + "|" + player.currentMedia.durationString;
}

</script>
<body >
<table width= ">"
<tr>
<td><object id= "Player" classid= "Clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" type= "application/" X-oleobject "width=" height= ">"
<param name= "AutoStart" value= "false" >
<param name= "balance" value= "0" >
<param name= "currentposition" value= "0" >
<param name= "Currentmarker" value= "0" >
<param name= "Enablecontextmenu" value= "true" >
<param name= "Enableerrordialogs" value= "false" >
<param name= "Enabled" value= "true" >
<param name= "fullscreen" value= "false" >
<param name= "Invokeurls" value= "false" >
<param name= "Mute" value= "true" >
<param name= "Playcount" value= "1" >
<param name= "Rate" value= "1" >
<param name= "Uimode" value= "None" >
<param name= "Volume" value= ">"
</object></td>
</tr>
<tr>
<td><span id= "Playerinfo" ></span></td>
</tr>
<tr>
<td>
<div align= "center" >
<input type= "button" class= "but11" onmouseover=this.classname= "but12"; Onmouseout=this.classname= "but11"; Name= "Previous" title= "Last Song" >
<input type= "button" class= "but21" onmouseover=this.classname= "but22"; Onmouseout=this.classname= "but21"; Name= "Play" title= "playing" >
<input type= "button" class= "But31" onmouseover=this.classname= "But32"; Onmouseout=this.classname= "But31"; Name= "Pause" title= "suspend" >
<input type= "button" class= "but41" onmouseover=this.classname= "But42"; Onmouseout=this.classname= "but41"; Name= "Stop" title= "stopped" >
<input type= "button" class= "But51" onmouseover=this.classname= "but52"; Onmouseout=this.classname= "But51"; Name= "Next" title= "Next" >
<input type= "button" class= "but61" onmouseover=this.classname= "but62"; Onmouseout=this.classname= "but61"; Name= "Voldown" title= "Volume-" >
<input type= "button" class= "but61" onmouseover=this.classname= "but62"; Onmouseout=this.classname= "but61"; Name= "Volup" title= "Volume +" >
<input type= "button" class= "but61" onmouseover=this.classname= "but62"; Onmouseout=this.classname= "but61"; Name= "Mute" title= "mute" >
<input type= "button" class= "but61" onmouseover=this.classname= "but62"; Onmouseout=this.classname= "but61"; Name= "balance" title= "channel" >
</div>
</td>
</tr>
</table>
<script language = "JavaScript" for = player event = Playstatechange (newstate) >
Switch (newstate) {
Case 1:
playerinfo.innerhtml = "Stop";
Break
Case 2:
playerinfo.innerhtml = "Pause";
Break
Case 3:
playerinfo.innerhtml = "playing";
Break
Case 4:
playerinfo.innerhtml = "4";
Break
Case 5:
playerinfo.innerhtml = "5";
Break
Case 6:
playerinfo.innerhtml = "is buffering ...";
Break
Case 7:
playerinfo.innerhtml = "7";
Break
Case 8:
playerinfo.innerhtml = "8";
Break
Case 9:
playerinfo.innerhtml = "Connecting ...";
Break
Case 10:
playerinfo.innerhtml = "ready." Welcome to <a href= ' http://www.knowsky.com ' >http://www.knowsky.com</a> ';
Break
Case 11:
playerinfo.innerhtml = "11";
Break
Default
playerinfo.innerhtml = "";
}
</script>

</body>



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.