Ravindra reddy

Ravindra reddy

  • NA
  • 12
  • 22.2k

create thumbnail from uploaded video in c# using flow player

Feb 10 2014 3:30 AM
Hi,
I want to create the thumbnail of uploaded video using flow player. i am writing this code and play with flow player but my problem is just display thumbnail in flow player....?


Regards,
Ravinder Reddy.

protected void btnUpload_Click(object sender, EventArgs e)
{
HttpFileCollection uploadedFiles = Request.Files;

for (int i = 0; i < uploadedFiles.Count; i++)
{
HttpPostedFile userPostedFile = uploadedFiles[i];
if (uploadedFiles.AllKeys[i] == "ctl00$MainContent$uploadvedio1")
{
try
{

if (userPostedFile != null && userPostedFile.ContentLength > 0)
{
string filename = Guid.NewGuid().ToString() + Path.GetExtension(userPostedFile.FileName);
string fileextention = Path.GetExtension(userPostedFile.FileName);
if (fileextention == ".mp4" || fileextention == ".flv" || fileextention == ".avi" || fileextention == ".f4v" || fileextention == ".mov")
{
byte[] fileData = null;
using (var binaryReader = new BinaryReader(userPostedFile.InputStream))
{
fileData = binaryReader.ReadBytes(userPostedFile.ContentLength);

string DGM_Filepath = (new ByteArrayConvertion()).DogMediabyteArrayToFileVedios(fileData, filename);
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "insert into tbldogMedia(DogId,FileName, MediaType,MimeType, Data,FilePath) values (@DogId,@FileName,@MediaType,@MimeType,@Data,@DGM_Filepath)";
cmd.Parameters.AddWithValue("@DogId", DogId);
cmd.Parameters.AddWithValue("@FileName", filename);
cmd.Parameters.AddWithValue("@MediaType", "2");
cmd.Parameters.AddWithValue("@MimeType", userPostedFile.ContentType);
cmd.Parameters.AddWithValue("@Data", fileData);
cmd.Parameters.AddWithValue("@DGM_Filepath", DGM_Filepath);

cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}

}
}
else
{
string message = "Please Select .mp4,.flv,.avi videos";
// string url = string.Format("Dogs.aspx");
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
// script += url;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "Redirect", script, true);
}


BindGrid();
}
}
catch (Exception ex)
{

}
}

}
}