像Facebook这样的asp.net中的视频共享 [英] Video Sharing in asp.net like Facebook
本文介绍了像Facebook这样的asp.net中的视频共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的朋友.
任何人都可以帮助我如何在asp.net中共享视频.例如
只是在其中添加一个网址,然后在我的网站中显示该视频.
就像脸书一样.
感谢和问候
Dear Friends.
Can any one help me in how to share a video in asp.net. e.g
just to put a url in it and Then Display that video in my Site.
just like in face book.
Thanks and regards
推荐答案
添加此网址
嵌入多媒体 [ ^ ]
如果有人想分享视频网址,则可以在对象标签中显示该视频
chink this url
Embedding Multimedia[^]
if someone want to share videourl you can show that video in object tag
希望这对您有所帮助..
Hope this helps you..
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">protected void Button1_Click(object sender, EventArgs e) {
try {
string mySourceUrl = this.TextBox1.Text;
bool isFullSize = false;this.Literal1.Text = this.GetWmaObject(mySourceUrl, isFullSize); }
catch (Exception ex) { this.Response.Write(ex.ToString()); }
}
private string GetWmaObject(string sourceUrl, bool isFullSize) {
string myObjectTag = "";sourceUrl = sourceUrl + ""; sourceUrl = sourceUrl.Trim();
if (sourceUrl.Length > 0)
{ //Continue.
} else
{
throw new System.ArgumentNullException("sourceUrl");} string myWidthAndHeight = "";
if (isFullSize) {
myWidthAndHeight = ""; }
else {
myWidthAndHeight = "width='640' height='480'"; }
myObjectTag = myObjectTag + "<object classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' id='player' " + myWidthAndHeight + " standby='Please wait while the object is loaded...'>";
myObjectTag = myObjectTag + "<param name='url' value='" + sourceUrl + "' />";
myObjectTag = myObjectTag + "<param name='src' value='" + sourceUrl + "' />";myObjectTag = myObjectTag + "<param name='AutoStart' value='true' />";
myObjectTag = myObjectTag + "<param name='Balance' value='0' />";
//-100 is fully left, 100 is fully right.
myObjectTag = myObjectTag + "<param name='CurrentPosition' value='0' />";
//Position in seconds when starting.
myObjectTag = myObjectTag + "<param name='showcontrols' value='true' />";
//Show play/stop/pause controls. myObjectTag = myObjectTag + "<param name='enablecontextmenu' value='true' />";
//Allow right-click.
myObjectTag = myObjectTag + "<param name='fullscreen' value='" + isFullSize.ToString() + "' />";
//Start in full screen or not. myObjectTag = myObjectTag + "<param name='mute' value='false' />";
myObjectTag = myObjectTag + "<param name='PlayCount' value='1' />"; //Number of times the content will play.
myObjectTag = myObjectTag + "<param name='rate' value='1.0' />"; //0.5=Slow, 1.0=Normal, 2.0=Fast
myObjectTag = myObjectTag + "<param name='uimode' value='full' />"; // full, mini, custom, none, invisible
myObjectTag = myObjectTag + "<param name='showdisplay' value='true' />"; //Show or hide the name of the file.
myObjectTag = myObjectTag + "<param name='volume' value='50' />"; // 0=lowest, 100=highest
myObjectTag = myObjectTag + "</object>";return myObjectTag; }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server"> <div>
<br /> <br />
<asp:literal id="Literal1" runat="server"></asp:literal>
<br />
<br /> <asp:textbox id="TextBox1" runat="server" width="500px" height="50px" wrap="true" textmode="multiLine" readonly="false" >http://download.microsoft.com/download/8/3/6/836dd5f8-fa92-499f-8219-0d326f13bf18/hilo_data_final.wmv</asp:textbox>
<br />
<br />
<asp:button id="Button1" runat="server" text="Load Video" onclick="But<pre lang="xml"><%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">protected void Button1_Click(object sender, EventArgs e) {
try {
string mySourceUrl = this.TextBox1.Text;
bool isFullSize = false;this.Literal1.Text = this.GetWmaObject(mySourceUrl, isFullSize); }
catch (Exception ex) { this.Response.Write(ex.ToString()); }
}
private string GetWmaObject(string sourceUrl, bool isFullSize) {
string myObjectTag = "";sourceUrl = sourceUrl + ""; sourceUrl = sourceUrl.Trim();
if (sourceUrl.Length > 0)
{ //Continue.
} else
{
throw new System.ArgumentNullException("sourceUrl");} string myWidthAndHeight = "";
if (isFullSize) {
myWidthAndHeight = ""; }
else {
myWidthAndHeight = "width='640' height='480'"; }
myObjectTag = myObjectTag + "<object classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' id='player' " + myWidthAndHeight + " standby='Please wait while the object is loaded...'>";
myObjectTag = myObjectTag + "<param name='url' value='" + sourceUrl + "' />";
myObjectTag = myObjectTag + "<param name='src' value='" + sourceUrl + "' />";myObjectTag = myObjectTag + "<param name='AutoStart' value='true' />";
myObjectTag = myObjectTag + "<param name='Balance' value='0' />";
//-100 is fully left, 100 is fully right.
myObjectTag = myObjectTag + "<param name='CurrentPosition' value='0' />";
//Position in seconds when starting.
myObjectTag = myObjectTag + "<param name='showcontrols' value='true' />";
//Show play/stop/pause controls. myObjectTag = myObjectTag + "<param name='enablecontextmenu' value='true' />";
//Allow right-click.
myObjectTag = myObjectTag + "<param name='fullscreen' value='" + isFullSize.ToString() + "' />";
//Start in full screen or not. myObjectTag = myObjectTag + "<param name='mute' value='false' />";
myObjectTag = myObjectTag + "<param name='PlayCount' value='1' />"; //Number of times the content will play.
myObjectTag = myObjectTag + "<param name='rate' value='1.0' />"; //0.5=Slow, 1.0=Normal, 2.0=Fast
myObjectTag = myObjectTag + "<param name='uimode' value='full' />"; // full, mini, custom, none, invisible
myObjectTag = myObjectTag + "<param name='showdisplay' value='true' />"; //Show or hide the name of the file.
myObjectTag = myObjectTag + "<param name='volume' value='50' />"; // 0=lowest, 100=highest
myObjectTag = myObjectTag + "</object>";return myObjectTag; }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server"> <div>
<br /> <br />
<asp:literal id="Literal1" runat="server"></asp:literal>
<br />
<br /> <asp:textbox id="TextBox1" runat="server" width="500px" height="50px" wrap="true" textmode="multiLine" readonly="false" >http://download.microsoft.com/download/8/3/6/836dd5f8-fa92-499f-8219-0d326f13bf18/hilo_data_final.wmv</asp:textbox>
<br />
<br />
<asp:button id="Button1" runat="server" text="Load Video" onclick="Button1_Click" /> </div>
</form>
</body>
</html>
ton1_Click"/></div>
</form>
</body>
</html>
ton1_Click" /> </div>
</form>
</body>
</html>
这篇关于像Facebook这样的asp.net中的视频共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文