日期:2014-05-16  浏览次数:20403 次

关于播放器的支持中文问题
播放器为
HTML code
<object id="wmpPlayer" style="display:none" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
        codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
        standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" style="display:none">
        <param name="ShowControls" value="false"/>
        <param name="loop" value="1">
    </object>

点击播放时
 var wmpPlayer = document.getElementById("wmpPlayer");
 wmpPlayer.FileName = url;
 wmpPlayer.play();

英文可以,但是中文没有声音。
环境是xp+tomcat,请问是不是因为环境的问题

------解决方案--------------------
HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>默认标题 by songpeng</title>
<script language="JavaScript" type="text/javascript">
function btnClick()
{
    var wmpPlayer = document.getElementById("wmpPlayer"); 
    wmpPlayer.FileName = "http://www.ct21.com.cn/bbs/moive/千里之外.wma"; 
    wmpPlayer.play(); 
}
</script>
</head>

<body>
<form>
<object id="wmpPlayer" style="display:none" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
        codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
        standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" style="display:none">
        <param name="ShowControls" value="false"/>
        <param name="loop" value="1">
    </object>


<input type = "button" onclick = "javascript:btnClick();" value = "播放" />
</form>
</body>
</html>

------解决方案--------------------
HTML code
<script>
function play(id,url,mode){
    var Madie='',Real=''
    Madie+="<object id='mplayer' width='300' height='50' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' align='baseline' border='0' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject'>\r\n"
    Madie+="<param name='FileName' value='"
    Madie+=url+"'>\r\n"
    Madie+="<param name='ShowControls' value='1'>\r\n"
    Madie+="<param name='ShowPositionControls' value='0'>\r\n"
    Madie+="<param name='ShowAudioControls' value='1'>\r\n"
    Madie+="<param name='ShowTracker' value='1'>\r\n"
    Madie+="<param name='ShowDisplay' value='0'>\r\n"
    Madie+="<param name='ShowStatusBar' value='1'>\r\n"
    Madie+="<param name='AutoSize' value='0'>\r\n"
    Madie+="<param name='ShowGotoBar' value='0'>\r\n"
    Madie+="<param name='ShowCaptioning' value='0'>\r\n"
    Madie+="<param name='AutoStart' value='1'>\r\n"
    Madie+="<param name='PlayCount' value='0'>\r\n"
    Madie+="<param name='AnimationAtStart' value='0'>\r\n"
    Madie+="<param name='TransparentAtStar