欢迎来到福编程网,本站提供各种互联网专业知识!

javascript 播放器 控制

发布时间:2007-01-22 作者: 来源:转载
详细参数可查询MSDNhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay/mmp_sdk/settingsobject.aspvarstate;//初始化functionplayerinit(){player.url="mp3.m3u";player.settings.autoStart=false;}//播放functionplay(){if(player
详细参数可查询MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay/mmp_sdk/settingsobject.asp





varstate;

//初始化
functionplayerinit()
{
player.url="mp3.m3u";
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;
}











































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="准备就绪。欢迎光临http://mp3.asp2004.net";
break;
case11:
playerinfo.innerHTML="11";
break;
default:
playerinfo.innerHTML="";
}



相关推荐