how to display the video file in asp.net using embed tag
I have use this code but it can't perform any action.
please solve this problem.
<body>
<form id="fromPlayVideo" runat="server">
<div> <br /> <br />
<asp:literal id="Literal1" runat="server"></asp:literal>
<br /> <br />
<asp:textbox id="txtURL" runat="server" width="500px" height="50px" wrap="true"
textmode="multiLine" readonly="false">
http://HIMASAGAR/PLAY_VIDEO/Dance.wmv</asp:textbox>
<br /> <br />
<asp:button id="btnPlayVideo" runat="server" text="Play Video" onclick="btnPlayVideo_Click" />
</div>
</form>
</body>
Code Behind
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
/// <summary>
/// Created by Himasagar Kutikuppala
/// </summary>
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// Play button click event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPlayVideo_Click(object sender, EventArgs e)
{
try
{
string himaSagarURL = this.txtURL.Text;
bool isFullSize = false;
this.Literal1.Text = this.Play_Video(himaSagarURL, isFullSize);
}
catch (Exception ex)
{
this.Response.Write(ex.ToString());
}
}
/// <summary>
/// Play Video method
/// </summary>
/// <param name="sagarURL"></param>
/// <param name="isFullSize"></param>
/// <returns></returns>
private string Play_Video(string sagarURL, bool isFullSize)
{
string himaSagarObject = "";
sagarURL = sagarURL + "";
sagarURL = sagarURL.Trim();
if (sagarURL.Length > 0)
{ //Continue.
}
else
{
throw new System.ArgumentNullException("sagarURL"); }
string himaSagarWidthAndHeight = "";
if (isFullSize)
{
himaSagarWidthAndHeight = "";
}
else
{
himaSagarWidthAndHeight = "width='640' height='480'";
}
himaSagarObject = himaSagarObject + "<object classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' id='player' " + himaSagarWidthAndHeight + " standby='Please wait while the object is loaded...'>";
himaSagarObject = himaSagarObject + "<param name='url' value='" + sagarURL + "' />";
himaSagarObject = himaSagarObject + "<param name='src' value='" + sagarURL + "' />";
himaSagarObject = himaSagarObject + "<param name='AutoStart' value='true' />";
himaSagarObject = himaSagarObject + "<param name='Balance' value='0' />"; //-100 is fully left, 100 is fully right.
himaSagarObject = himaSagarObject + "<param name='CurrentPosition' value='0' />"; //Position in seconds when starting.
himaSagarObject = himaSagarObject + "<param name='showcontrols' value='true' />"; //Show play/stop/pause controls.
himaSagarObject = himaSagarObject + "<param name='enablecontextmenu' value='true' />"; //Allow right-click.
himaSagarObject = himaSagarObject + "<param name='fullscreen' value='" + isFullSize.ToString() + "' />"; //Start in full screen or not.
himaSagarObject = himaSagarObject + "<param name='mute' value='false' />";
himaSagarObject = himaSagarObject + "<param name='PlayCount' value='1' />"; //Number of times the content will play.
himaSagarObject = himaSagarObject + "<param name='rate' value='1.0' />"; //0.5=Slow, 1.0=Normal, 2.0=Fast
himaSagarObject = himaSagarObject + "<param name='uimode' value='full' />"; // full, mini, custom, none, invisible
himaSagarObject = himaSagarObject + "<param name='showdisplay' value='true' />"; //Show or hide the name of the file.
himaSagarObject = himaSagarObject + "<param name='volume' value='50' />"; // 0=lowest, 100=highest
himaSagarObject = himaSagarObject + "</object>";
return himaSagarObject;
}
}