//MediaPlayer.ascx<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MediaPlayer.ascx.cs" Inherits="MediaPlayer" %><script language="javascript" type="text/javascript">
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
var oeTags='<object id="mediaPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"'
+'width="'+width+'" height="'+height+'"'
+'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"'
+'standby="Loading Microsoft Windows Media Player components..."'
+'type="application/x-oleobject">'
+' <param name="autoStart" value="false"/>'
+' <param name="url" value="'+videolink+'"/>'
+' <param name="wmode" value="transparent"/>'
+' <param name="uiMode" value="full"/>'
+' <param name="loop" value="false"/>'
+' <embed id ="EmbedmediaPlayer"'
+' type ="application/x-mplayer2"'
+' src ="'+videolink+'"'
+' width ="'+width+'"'
+' heigth ="'+height+'">'
+' </embed>'
+'</object>';
document.write(oeTags);
</script>//MediaPlayer.ascx.cspublic partial class MediaPlayer : System.Web.UI.UserControl
{
private int width;
private int height;
private string videolink; public int Width
{
set
{
width = value;
}
} public int Height
{
set
{
height = value;
}
} public string Videolink
{
set
{
videolink = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.Literal1.Text = "var width" + width + ";var height=" + height + ";var videolink='" + videolink + "';";
}
}//VideoOnline.aspx</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:MediaPlayer ID="MediaPlayer1" runat="server" />
</div>
</form>
</body>//VideoOnline.aspx.cspublic partial class Video : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.MediaPlayer1.Width = 400;
this.MediaPlayer1.Height = 300;
this.MediaPlayer1.Videolink = "mediaplayer.wmv";
}
}
这样做完后 运行没有任何错误 但是页面是空白的
什么问题呢?要是不要这个方法 其他方法怎么做?
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
var oeTags='<object id="mediaPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"'
+'width="'+width+'" height="'+height+'"'
+'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"'
+'standby="Loading Microsoft Windows Media Player components..."'
+'type="application/x-oleobject">'
+' <param name="autoStart" value="false"/>'
+' <param name="url" value="'+videolink+'"/>'
+' <param name="wmode" value="transparent"/>'
+' <param name="uiMode" value="full"/>'
+' <param name="loop" value="false"/>'
+' <embed id ="EmbedmediaPlayer"'
+' type ="application/x-mplayer2"'
+' src ="'+videolink+'"'
+' width ="'+width+'"'
+' heigth ="'+height+'">'
+' </embed>'
+'</object>';
document.write(oeTags);
</script>//MediaPlayer.ascx.cspublic partial class MediaPlayer : System.Web.UI.UserControl
{
private int width;
private int height;
private string videolink; public int Width
{
set
{
width = value;
}
} public int Height
{
set
{
height = value;
}
} public string Videolink
{
set
{
videolink = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.Literal1.Text = "var width" + width + ";var height=" + height + ";var videolink='" + videolink + "';";
}
}//VideoOnline.aspx</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:MediaPlayer ID="MediaPlayer1" runat="server" />
</div>
</form>
</body>//VideoOnline.aspx.cspublic partial class Video : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.MediaPlayer1.Width = 400;
this.MediaPlayer1.Height = 300;
this.MediaPlayer1.Videolink = "mediaplayer.wmv";
}
}
这样做完后 运行没有任何错误 但是页面是空白的
什么问题呢?要是不要这个方法 其他方法怎么做?
另外,请到Insus.NET新blog:http://insus.cnblogs.com找到联系方式,可以在线解决.
然后加
is(!IsPostBack)
{
}
你要让它播放
或者让其为true还有地址的参数名是url,不是Videolink吧