SharePoint 视频播放WebPart

代码是摘自建义的亮剑一书里面的代码 ,代码如下

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls.WebParts;

namespace CodeArt.SharePoint.WebParts
{
/// <summary>
/// 可以制定一个视频文件的路径进行播放
/// </summary>
public class VideoWebPart : BaseSPWebPart
{
private string _VideoURL;
[Personalizable(PersonalizationScope.Shared)]
[WebBrowsable]
[WebDisplayName("视频文件路径")]
public string VideoURL
{
get { return _VideoURL; }
set { _VideoURL = value; }
}

const string html = @"<object name='wmplayer' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase='http://activex.microsoft.com/activex/
controls/mplayer/en/
nsmp2inf.cabVersion=6,4,5,715' </DIV>
type='application/x-oleobject' width=405 height=340 hspace='0'
standby='Loading Microsoft Windows Media Player components'
id='NSPlay'>
<param name='AutoRewind' value=0>
<param name='FileName' value='{0}'/>
<param name='ShowControls' value='1'>
<param name='ShowPositionControls' value='0'>
<param name='ShowAudioControls' value='1'>
<param name='ShowTracker' value='0'>
<param name='ShowDisplay' value='0'>
<param name='ShowStatusBar' value='1'>
<param name='ShowGotoBar' value='0'>
<param name='ShowCaptioning' value='0'>
<param name='AutoStart' value='1'>
<param name='Volume' value='2000'>
<param name='AnimationAtStart' value='0'>
<param name='TransparentAtStart' value='0'>
<param name='AllowChangeDisplaySize' value='1'>
<param name='AllowScan' value='0'>
<param name='EnableContextMenu' value='0'>
<param name='ClickToPlay' value='0'>
</object>
";

protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
{
if (!String.IsNullOrEmpty(this.VideoURL))
writer.Write( String.Format( html , this.VideoURL ) );
}

}
}

 

你可能感兴趣的:(SharePoint)