播放MP3
url为MP3文件的路径,width,height为播放器大小
private string mp3(string url, int width, int height)
{
return @"<object id='mplayer' width='460' height='68' 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'>
<param name='FileName' value='"+url+@"'>
<param name='ShowControls' value='1'>
<param name='ShowPositionControls' value='0'>
<param name='ShowAudioControls' value='1'>
<param name='ShowTracker' value='1'>
<param name='ShowDisplay' value='0'>
<param name='ShowStatusBar' value='1'>
<param name='AutoSize' value='0'>
<param name='ShowGotoBar' value='0'>
<param name='ShowCaptioning' value='0'>
<param name='AutoStart' value='1'>
<param name='PlayCount' value='2'>
<param name='AnimationAtStart' value='0'>
<param name='TransparentAtStart' value='0'>
<param name='AllowScan' value='0'>
<param name='EnableContextMenu' value='1'>
<param name='ClickToPlay' value='0'>
<param name='InvokeURLs' value='1'>
<param name='DefaultFrame' value='datawindow'>
<embed src='" + url + @"' align='baseline'
border='0' width='460' height='68' type='application/x-mplayer2'
pluginspage='http://www.microsoft.com/isapi/redir.dll?prd=windows&
sbp=mediaplayer&ar=media&sba=plugin&'
name='MediaPlayer' showcontrols='1' showpositioncontrols='0'
showaudiocontrols='1' showtracker='1' showdisplay='0'
showstatusbar='1' autosize='0' showgotobar='0' showcaptioning='0'
autostart='0' autorewind='0'
animationatstart='0' transparentatstart='0' allowscan='1'
enablecontextmenu='1' clicktoplay='0' invokeurls='1' defaultframe='datawindow'>
</embed>
</object>
";
}
wma,wmv播放
private string wmv(string url, int width, int height)
{
return @"<object id='WindowsMediaPlayer1' style='width: 316px; height: 297px' height='297px' width='316px'
classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'><param name='URL' value='" + url + @"'>
<param name='rate' value='1' /><param name='balance' value='0' />
<param name='currentPosition' value='0' />
<param name='defaultFrame' value='' /><param name='playCount' value='1' />
<param name='autoStart' value='0' /><param name='currentMarker' value='0' />
<param name='invokeURLs' value='-1' /><param name='baseURL' value='' />
<param name='volume' value='50' /><param name='mute' value='0' />
<param name='uiMode' value='full' />
<param name='stretchToFit' value='0' /><param name='windowlessVideo' value='0' />
<param name='enabled' value='-1' /><param name='enableContextMenu' value='-1' />
<param name='fullScreen' value='0' /><param name='SAMIStyle' value='' />
<param name='SAMILang' value='' /><param name='SAMIFilename' value='' />
<param name='captioningID' value='' /><param name='enableErrorDialogs' value='0' />
<param name='_cx' value='8361' /><param name='_cy' value='7858' />
<param name='rate' value='1' />
</object>";
}
图片
private string img(string url, int width, int height)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<img src=\"" + url + "\" height=\"" + height + "\" width=\"" + width + "\" border=\"0\">");
return sb.ToString();
}