Rumah > Artikel > hujung hadapan web > 在网页中控制wmplayer播放器_JavaScript
详细参数可查询MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmplay/mmp_sdk/settingsobject.asp
//初始化
function playerinit()
{
player.url="mp3.m3u";
player.settings.autoStart = false ;
}
//播放
function play()
{
if (player.controls.isavailable('play'))
{
player.controls.play();
state=setInterval("updatetime()",1000);
playerinfo.innerHTML = "播放";
}
}
//暂停
function pause()
{
if (player.controls.isavailable('pause'))
{
player.controls.pause();
clearInterval(state);
playerinfo.innerHTML = "暂停";
}
}
//停止
function stop()
{
if (player.controls.isavailable('stop'))
{
player.controls.stop();
clearInterval(state);
playerinfo.innerHTML = "停止";
}
}
//前首
function previous()
{
if (player.controls.isavailable( 'previous' ))
{
player.controls.previous();
playerinfo.innerHTML = "前一首";
}
}
//后首
function next()
{
if (player.controls.isavailable( 'next' ))
{
player.controls.next();
playerinfo.innerHTML = "下一首";
}
}
//?
function step()
{
if (player.controls.isavailable( 'step' ))
player.controls.step( 1 );
}
//音量-
function voldown()
{
if ( player.settings.volume {
player.settings.volume = 0;
playerinfo.innerHTML = "0";
}
else
{
player.settings.volume -= 5;
playerinfo.innerHTML = player.settings.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;
}
}
//静音
function mute()
{
player.settings.mute = !player.settings.mute;
}
//声道
function balance()
{
switch (player.settings.balance)
{
case 0:
player.settings.balance = 100;
playerinfo.innerHTML = '左声道';
break;
case 100:
player.settings.balance = -100;
playerinfo.innerHTML = '右声道';
break;
case -100:
player.settings.balance = 0;
playerinfo.innerHTML = '全声道';
break;
default :
player.settings.balance = 0;
playerinfo.innerHTML = '全声道';
break;
}
}
//更新时间
function updatetime()
{
playerinfo.innerHTML = player.controls.currentPositionString + " | " + player.currentMedia.durationString;
}
|