Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i want to add video/audio on my website taking link from my database and videos also are on same pc , plz help m out
Posted
Comments
Neetesh Agarwal 30-Mar-13 5:27am    
To run Video in asp.net .......
\\code in .aspx page

<embed type="application/x-ms-wmp" width="270" height="480" src="C:\Users\Public\Videos\Sample Videos\Wildlife.avi"
showstatusbar="1">
<param name="AutoStart" value="1" />
</embed>

HTML
<pre lang="HTML">

XML
<embed type="application/x-ms-wmp" width="270" height="480" src="C:\Users\Public\Videos\Sample Videos\Wildlife.avi" showstatusbar="1">
<param name="AutoStart" value="1" />
 </embed>
 
Share this answer
 
v2
Comments
Neetesh Agarwal 30-Mar-13 5:36am    
If you want to download video from website use this code.

public void Downlaod()
{


string serverfilepath = "Path of video";
string filename = "downloadvideo.avi";
// MessageBox.Show(serverfilepath);
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.ContentType = "video/x-ms-wmv";
Response.Charset = "utf-8";
Response.HeaderEncoding = UnicodeEncoding.UTF8;
Response.ContentEncoding = UnicodeEncoding.UTF8;
FileInfo fi = new FileInfo(serverfilepath);
if (fi.Exists)
{
using (FileStream fs = fi.OpenRead())
{
// you should really buffer this...

Byte[] bytes = new Byte[fs.Length];
fs.Read(bytes, 0, (int)fs.Length);
Response.BinaryWrite(bytes);
}
}
Response.End();
}
C#
If you want to download video from website use this code.

public void Downlaod()
        {


             string serverfilepath = "Path of video";
            string filename = "downloadvideo.avi";
            // MessageBox.Show(serverfilepath);
            Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
            Response.ContentType = "video/x-ms-wmv";
            Response.Charset = "utf-8";
            Response.HeaderEncoding = UnicodeEncoding.UTF8;
            Response.ContentEncoding = UnicodeEncoding.UTF8;
            FileInfo fi = new FileInfo(serverfilepath);
            if (fi.Exists)
            {
                using (FileStream fs = fi.OpenRead())
                {
                    // you should really buffer this...

                    Byte[] bytes = new Byte[fs.Length];
                    fs.Read(bytes, 0, (int)fs.Length);
                    Response.BinaryWrite(bytes);
                }
            }
            Response.End();
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900