Play Video File in Asp. Net 3.5 in IIS
Posted
by Sneha Joshi
on Stack Overflow
See other posts from Stack Overflow
or by Sneha Joshi
Published on 2010-06-03T10:33:47Z
Indexed on
2010/06/03
10:34 UTC
Read the original article
Hit count: 317
I have developed an application to upload a video on the server and then play it. It runs well when i execute it in Visual Studio 2008 in-built web server..
But when I configure it on IIS, the video does not play... Is there any settings needed in IIS to play video ??
The code of Button Click event -
**protected void btnPlayVideo_Click(object sender, EventArgs e)
{
try
{
string himaSagarURL = this.lnkbtnVideo.Text;
bool isFullSize = false;
this.Literal1.Text = this.Play_Video(himaSagarURL, isFullSize);
}
catch (Exception ex)
{
this.Response.Write(ex.ToString());
}
}
This button click event calls the Play_Video method which is given below.. The code I used for embedding -
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;
}**
© Stack Overflow or respective owner