JSP页面嵌入Windows播放器

如果客户端安装了 Windows Media Player 7,那么以下代码使得网页可以嵌入它。如果客户端尚未安装版本 7,但是它具有较早的版本,则会显示此版本

支持的版本:

  • Microsoft Windows Media Player 6.0
  • Microsoft Windows Media Player 6.1
  • Microsoft Windows Media Player 6.2
  • Microsoft Windows Media Player 6.4
  • Microsoft Windows Media Player 7.0
  • Microsoft Windows Media Player 7.1

以下是代码:

 

<html>
<head>
<title>Embedding Windows Media Player</title>
</head>
<body>

<!-- Check Media Player Version -->

<SCRIPT LANGUAGE="JavaScript">

var WMP7;

if(window.ActiveXObject)
{
    WMP7 = new ActiveXObject("WMPlayer.OCX.7");
}
else if (window.GeckoActiveXObject)
{
     WMP7 = new GeckoActiveXObject("WMPlayer.OCX.7");
}

// Windows Media Player 7 Code
if ( WMP7 )
{
     document.write ('<OBJECT ID=MediaPlayer ');
     document.write (' CLASSID=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6');
     document.write (' standby="Loading Microsoft Windows Media Player components..."');
     document.write (' TYPE="application/x-oleobject" width="286" height="225">');
     document.write ('<PARAM NAME="url" VALUE="http://ncnetshow/station1.asx">');
     document.write ('<PARAM NAME="AutoStart" VALUE="true">');
     document.write ('<PARAM NAME="ShowControls" VALUE="1">');
     document.write ('<PARAM NAME="uiMode" VALUE="mini">');
     document.write ('</OBJECT>');
}

// Windows Media Player 6.4 Code
else
{
     //IE Code
     document.write ('<OBJECT ID=MediaPlayer ');
     document.write ('CLASSID=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 ');
     document.write ('CODEBASE=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715 ');
     document.write ('standby="Loading Microsoft Windows Media Player components..." ');
     document.write ('TYPE="application/x-oleobject" width="286" height="225">');
     document.write ('<PARAM NAME="FileName" VALUE="http://ncnetshow/station1.asx">');
     document.write ('<PARAM NAME="AutoStart" VALUE="true">');
     document.write ('<PARAM NAME="ShowControls" VALUE="1">');

     //Netscape code
     document.write ('    <Embed type="application/x-mplayer2"');
     document.write ('        pluginspage="http://www.microsoft.com/windows/windowsmedia/"');
     document.write ('        filename="http://ncnetshow/station1.asx"');
     document.write ('        src="http://ncnetshow/station1.asx"');
     document.write ('        Name=MediaPlayer');
     document.write ('        ShowControls=1');
     document.write ('        ShowDisplay=1');
     document.write ('        ShowStatusBar=1');
     document.write ('        width=290');
     document.write ('        height=320>');
     document.write ('    </embed>');

     document.write ('</OBJECT>');
}

</SCRIPT>

</body>
</html>
   

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值