asp.net中怎么播放音乐
我用vb.net写了个网页,现需要在网页中播放声音,请问有现成的控件吗?如果没有,用什么办法解决?注意:我只播放单个指定文件,格式为MP3,请高手多指教,谢谢! --------------------编程问答-------------------- 关注 --------------------编程问答-------------------- <object data="music.mp3" type="application/x-mplayer2"width="0"height="0">
<paramname="src"value="music.mp3">
<paramname="autostart"value="1">
<paramname="playcount"value="infinite">
</object>
--------------------编程问答-------------------- <embed src="x.mp3" autostart="true"></embed> --------------------编程问答-------------------- 帮忙顶 --------------------编程问答-------------------- 网上搜网页播放音乐 --------------------编程问答--------------------
UP,这个简单通用。
或者你可以用Windowsmediaplayer。跟在静态HTML文件里一样的写法。 --------------------编程问答-------------------- <div id="div_mp3">
</div>
<script type="text/javascript">
window.onload = function() {
var div_mp3 = document.getElementById("div_mp3");
if (div_mp3) {
div_mp3.style.visibility = "hidden";
div_mp3.innerHTML = get_mp3();
}
function rnd() {
rnd.seed = (rnd.seed * 9301 + 49297) % 233280;
return rnd.seed / (233280.0);
};
var len_mp3 = 8;
function get_mp3() {
rnd.today = new Date();
rnd.seed = rnd.today.getTime();
var num = 0;
var arrayAd = new Array(len_mp3);
arrayAd[1] = "./images/奥斯卡 - 此情可待.mp3";
arrayAd[2] = "./images/叶启田 - 爱拼才会赢.mp3";
arrayAd[3] = "./images/奥斯卡 - 电话诉衷情.mp3";
arrayAd[4] = "./images/黄奕蓉 - 祝你幸福.mp3";
arrayAd[5] = "./images/毛阿敏 - 渴望.mp3";
arrayAd[6] = "./images/人在旅途 - 人在旅途.mp3";
arrayAd[7] = "./images/the Corrs - Summer Sunshine.mp3";
arrayAd[8] = "./images/Bryan Adams - Everything I Do.mp3";
var files = "";
num = rand(len_mp3);
files = arrayAd[num];
var s = "";
if (-1 != navigator.userAgent.indexOf("MSIE")) {
s = '<object id="PTMediaPlayer" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="200px"> ' +
' <param name="URL" value="' + files + '" />' +
' <param name="playCount" value="1" />' +
' <param name="autoStart" value="1" />' +
' <param name="volume" value="50" />' +
'</object>';
}
else //if (-1 != navigator.userAgent.indexOf("Firefox"))
{
s='<object id="PTMediaPlayer" type="application/x-ms-wmp" width="200px"> ' +
' <param name="URL" value="' + files + '" />' +
' <param name="playCount" value="1" />' +
' <param name="autoStart" value="1" />' +
' <param name="volume" value="50" />' +
'</object>';
}
return s;
}
</script>
http://www.mybuffet.cn --------------------编程问答-------------------- 以上几种只能实现当前页,而坐不到qq空间那样全局播放 --------------------编程问答-------------------- http://blog.csdn.net/xianfajushi/archive/2009/08/14/4423569.aspx不论编程语言道理都是一样的 --------------------编程问答-------------------- jfzr --------------------编程问答-------------------- 楼上答案好多~ --------------------编程问答-------------------- mark --------------------编程问答-------------------- 谢谢各位 --------------------编程问答-------------------- 有别人写好的代码,找个嵌进去 --------------------编程问答-------------------- <object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
height="300" id="nstv" style="BORDER-BOTTOM: rgb(192,192,192) 7px; BORDER-LEFT: rgb(192,192,192) 7px; BORDER-RIGHT: rgb(192,192,192) 7px; BORDER-TOP: rgb(192,192,192) 7px; LEFT: 0px; TOP: 0px"
type="application/x-oleobject" width="400" standby="Loading Microsoft Windows Media Player components...">
<param name="AudioStream" value="-1"/>
<param name="AutoSize" value="0"/>
<param name="AutoStart" value="-1"/>
<param name="AnimationAtStart" value="0"/>
<param name="AllowScan" value="-1"/>
<param name="AllowChangeDisplaySize" value="-1"/>
<param name="AutoRewind" value="0"/>
<param name="Balance" value="0"/>
<param name="BaseURL" value=""/>
<param name="BufferingTime" value="6"/>
<param name="CaptioningID" value=""/>
<param name="ClickToPlay" value="-1"/>
<param name="CursorType" value="0"/>
<param name="CurrentPosition" value="-1"/>
<param name="CurrentMarker" value="0"/>
<param name="DefaultFrame" value=""/>
<param name="DisplayBackColor" value="0"/>
<param name="DisplayForeColor" value="16777215"/>
<param name="DisplayMode" value="0"/>
<param name="DisplaySize" value="0"/>
<param name="Enabled" value="-1"/>
<param name="EnableContextMenu" value="-1"/>
<param name="EnablePositionControls" value="-1"/>
<param name="EnableFullScreenControls" value="0"/>
<param name="EnableTracker" value="-1"/>
<param name="Filename" value='<%=Session["path"]%>'/> <param name="InvokeURLs" value="-1"/>
<param name="Language" value="-1"/>
<param name="Mute" value="0"/>
<param name="PlayCount" value="1"/>
<param name="PreviewMode" value="0"/>
<param name="Rate" value="1"/>
<param name="SAMILang" value=""/>
<param name="SAMIStyle" value=""/>
<param name="SAMIFileName" value=""/>
<param name="SelectionStart" value="-1"/>
<param name="SelectionEnd" value="-1"/>
<param name="SendOpenStateChangeEvents" value="-1"/>
<param name="SendWarningEvents" value="-1"/>
<param name="SendErrorEvents" value="-1"/>
<param name="SendKeyboardEvents" value="0"/>
<param name="SendMouseClickEvents" value="0"/>
<param name="SendMouseMoveEvents" value="0"/>
<param name="SendPlayStateChangeEvents" value="-1"/>
<param name="ShowCaptioning" value="0"/>
<param name="ShowControls" value="-1"/>
<param name="ShowAudioControls" value="-1"/>
<param name="ShowDisplay" value="0"/>
<param name="ShowGotoBar" value="0"/>
<param name="ShowPositionControls" value="-1"/>
<param name="ShowStatusBar" value="1"/>
<param name="ShowTracker" value="-1"/>
<param name="TransparentAtStart" value="-1"/>
<param name="VideoBorderWidth" value="0"/>
<param name="VideoBorderColor" value="0"/>
<param name="VideoBorder3D" value="0"/>
<param name="Volume" value="-60"/>
<param name="WindowlessVideo" value="0"/>
</object> --------------------编程问答-------------------- dddddd
补充:.NET技术 , ASP.NET