http://www.cnblogs.com/Dragon-China/archive/2006/12/01/579027.html
第一种是在apsx页面上放一个Lable控件
这种方式可以写Javascript等控制页面,和布局页面
如下:HTML页面代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>多媒体播放页面</TITLE>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<BODY ms_positioning="GridLayout" bottomMargin=10 topMargin=10>
<FORM id="Form1" method="post" runat="server">
<asp:Label id="lbl_MediaPlayer" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px"
runat="server" Width="104px"></asp:Label>
</FORM>
</BODY>
</HTML>
.cs页面代码:
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!this.IsPostBack)
{
this.lbl_MediaPlayer.Text = this.PlayMedia(filename);
}
}
public string PlayMedia(string MediaFile)
{
string strScript =
"<TABLE id=\"Table2\" align=\"center\" border=\"0\" runat=\"server\" width = '620' height ='450'>"
+"<TR>"
+"<TD align=\"center\">"
+"<OBJECT id=\"mdpTrailer\" classid=\"clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" name=\"mdpTrailer\" width='620' height = '450'>"
+"<PARAM NAME=\"AudioStream\" VALUE=\"-1\">"
+"<PARAM NAME=\"AutoSize\" VALUE=\"-1\">"
+"<PARAM NAME=\"AutoStart\" VALUE=\"-1\">"
+"<PARAM NAME=\"AnimationAtStart\" VALUE=\"-1\">"
+"<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=\"5\">"
+"<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=\"4\">"
+"<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=\""+ MediaFile + "\">"
+"<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=\"0\">"
+"<PARAM NAME=\"ShowTracker\" VALUE=\"-1\">"
+"<PARAM NAME=\"TransparentAtStart\" VALUE=\"0\">"
+"<PARAM NAME=\"VideoBorderWidth\" VALUE=\"0\">"
+"<PARAM NAME=\"VideoBorderColor\" VALUE=\"0\">"
+"<PARAM NAME=\"VideoBorder3D\" VALUE=\"0\">"
+"<PARAM NAME=\"Volume\" VALUE=\"-600\">"
+"<PARAM NAME=\"WindowlessVideo\" VALUE=\"0\">"
+"</OBJECT>"
+"</TD>"
+"</TR>"
+"</TABLE>";
return strScript;
}
第二种方式是直接在aspx页面放置播放器代码
Html代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>多媒体播放页面</TITLE>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<BODY ms_positioning="GridLayout" bottomMargin=10 topMargin=10>
<FORM id="Form1" method="post" runat="server">
<object id="MediaPlayer1" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="620" height="460" VIEWASTEXT>
<param name="filename" value="<%=PlayUrl%>">
<param name="AutoStart" value="1">
<param name="Enabled" value="-1">
<param name="ShowControls" value="-1">
<param name="ShowGotoBar" value="0">
<param name="ShowStatusBar" value="-1">
<param name="EnableFullScreenControls" value="0">
<param name="EnablePositionControls" value="0">
<param name="Volume" value="0">
<param name="DisplaySize" value="4">
<param name="SendErrorEvents" value="0">
<param name="enableContextMenu" value="0">
<param name="EnableTracker" value="-1">
<param name="AudioStream" value="-1">
<param name="AutoSize" value="0">
<param name="AnimationAtStart" value="-1">
<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="5">
<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="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="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="ShowAudioControls" value="-1">
<param name="ShowDisplay" value="0">
<param name="ShowPositionControls" value="-1">
<param name="ShowTracker" value="-1">
<param name="TransparentAtStart" value="0">
<param name="VideoBorderWidth" value="0">
<param name="VideoBorderColor" value="0">
<param name="VideoBorder3D" value="0">
<param name="WindowlessVideo" value="0">
</object>
</FORM>
</BODY>
</HTML>
.CS页面
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!this.IsPostBack)
{
int picID=System.Convert.ToInt32(Request.QueryString["pid"]);
MyNature.SQLServerDAL.Picture pic = new MyNature.SQLServerDAL.Picture();
string filename = pic.GetMulname(picID);
PlayUrl = filename;
}
}