codebase=http://activex.microsoft.com/ activex/controls/mplayer/en/nsmp2i">

网页中播放音乐的实现方法代码

80酷酷网    80kuku.com

  网页

第一种方式:采用wmplayer控件

<object name="wmplayer" classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95 width=0 height=0
codebase=http://activex.microsoft.com/ activex/controls/mplayer/en/nsmp2inf.cab# Version=5,1,52,701
height=180 id=MIDIPlayer type=application/x-oleobject VIEWASTEXT standby=" 加载 Microsoft Windows Media Player 组件...">

<param name="FileName" value=" http://yourURL/xxx.wma">
<param name="AutoStart" value="true">
<param name="AutoRewind" value="-1">
<param name="AnimationAtStart" value="false">
<param name="ShowControls" value="false">
<param name="ClickToPlay" value="false">
<param name="EnableContextMenu" value="true">
<param name="EnablePositionControls" value="false">
<param name="Balance" value="0">
<param name="ShowStatusBar" value="false">
<param name="AutoSize" value="0">

<embed type="application/x-mplayer2"
pluginspage="http:// www.microsoft.com/Windows/ Downloads /Contents/Products/MediaPlayer/"
filename src autostart="false" enablecontextmenu="false" clicktopla
y="false" enablepositioncontrols="false" showcontrols="0" showstatusbar="1" showdisplay="0">

</object>

第二种方式:html标签,似乎更简单

<bgsound id='bgsound' src="http://yourURL/xxx.mid" loop=-1 >
  <input type="button" value="停止" >
  <input type="button" value="开始" >
  <script language="JavaScript">
  function _start() {
   bgsound.src = "http://yourURL/xxx.mid";
  }
  function _stop(){
   bgsound.src = "";
  }
  </scrip>



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: