js控制wmplayer.docx
- 文档编号:8719134
- 上传时间:2023-02-01
- 格式:DOCX
- 页数:14
- 大小:20.97KB
js控制wmplayer.docx
《js控制wmplayer.docx》由会员分享,可在线阅读,更多相关《js控制wmplayer.docx(14页珍藏版)》请在冰豆网上搜索。
js控制wmplayer
js控制wmplayer
varstate;
//初始化
functionplayerinit()
{
player.url="music/beyond.mp3";
player.settings.autoStart=false;
}
//播放
functionplay()
{
if(player.controls.isavailable('play'))
{
player.controls.play();
state=setInterval("updatetime()",1000);
playerinfo.innerHTML="播放";
}
}
//暂停
functionpause()
{
if(player.controls.isavailable('pause'))
{
player.controls.pause();
clearInterval(state);
playerinfo.innerHTML="暂停";
}
}
//停止
functionstop()
{
if(player.controls.isavailable('stop'))
{
player.controls.stop();
clearInterval(state);
playerinfo.innerHTML="停止";
}
}
//前首
functionprevious()
{
if(player.controls.isavailable('previous'))
{
player.controls.previous();
playerinfo.innerHTML="前一首";
}
}
//后首
functionnext()
{
if(player.controls.isavailable('next'))
{
player.controls.next();
playerinfo.innerHTML="下一首";
}
}
//?
functionstep()
{
if(player.controls.isavailable('step'))
player.controls.step
(1);
}
//音量-
functionvoldown()
{
if(player.settings.volume<5)
{
player.settings.volume=0;
playerinfo.innerHTML="0";
}
else
{
player.settings.volume-=5;
playerinfo.innerHTML=player.settings.volume;
}
}
//音量+
functionvolup()
{
if(player.settings.volume>95)
{
player.settings.volume=100;
playerinfo.innerHTML="100";
}
else
{
player.settings.volume+=5;
playerinfo.innerHTML=player.settings.volume;
}
}
//静音
functionmute()
{
player.settings.mute=!
player.settings.mute;
}
//声道
functionbalance()
{
switch(player.settings.balance)
{
case0:
player.settings.balance=100;
playerinfo.innerHTML='左声道';
break;
case100:
player.settings.balance=-100;
playerinfo.innerHTML='右声道';
break;
case-100:
player.settings.balance=0;
playerinfo.innerHTML='全声道';
break;
default:
player.settings.balance=0;
playerinfo.innerHTML='全声道';
break;
}
}
//更新时间
functionupdatetime()
{
playerinfo.innerHTML=player.controls.currentPositionString+"|"+player.currentMedia.durationString;
}
6BF52A52-394A-11d3-B153-00C04F79FAA6"type="application/x-oleobject"width="300"height="60">
switch(newstate){
case1:
playerinfo.innerHTML="停止";
break;
case2:
playerinfo.innerHTML="暂停";
break;
case3:
playerinfo.innerHTML="正在播放";
break;
case4:
playerinfo.innerHTML="4";
break;
case5:
playerinfo.innerHTML="5";
break;
case6:
playerinfo.innerHTML="正在缓冲...";
break;
case7:
playerinfo.innerHTML="7";
break;
case8:
playerinfo.innerHTML="8";
break;
case9:
playerinfo.innerHTML="正在连接...";
break;
case10:
playerinfo.innerHTML="准备就绪。
欢迎光临
break;
case11:
playerinfo.innerHTML="11";
break;
default:
playerinfo.innerHTML="";
}