hi all experts,
I have code to play videos from database, dynamically using handler,
here, while storing the videos in database, i have converted them into binary format,
my table design is as below - ID, Name, Data
my question is, i am not able to bind the binary format video file on to the player,
my handler code is as below
public void ProcessRequest(HttpContext context)
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["constring"]);
SqlCommand cmd = new SqlCommand();
int id = int.Parse(context.Request.QueryString["id"]);
byte[] bytes=null;
string name;
try
{
cmd = new SqlCommand("select Name, Data from tbl_videos where Id=@Id", con);
cmd.Parameters.AddWithValue("@Id", id);
con.Open();
SqlDataReader sdr = cmd.ExecuteReader();
sdr.Read();
bytes = (byte[])sdr["Data"];
name = sdr["Name"].ToString();
context.Response.BinaryWrite(bytes);
con.Close();
}
catch (Exception ex)
{
ex.Message.ToString();
}
}
I have a datalist databound event,
protected void DataList2_ItemDataBound(object sender, DataListItemEventArgs e)
{
/// here LnkVideoID is the id of link button
///(it is nothing but, iam getting list of videos from database,
///& up on click of linkbutton appropriate video will be played.)
LinkButton LnkVideoID = (LinkButton)e.Item.FindControl("LnkVideoID");
string GetID = LnkVideoID.CommandArgument;
string objid = "getvideo.ashx?ID=" + GetID;
Session["value"] = objid.ToString();
LnkVideoID.PostBackUrl = Session["value"].ToString();
}
my player code is as below,
<object id="objid" type="application/x-shockwave-flash" data="player_flv_multi.swf" width="540"
height="300">
<param name="movie" value="player_flv_multi.swf" />
<param name="allowFullScreen" value="true" />
<param name="FlashVars" value="<%= Session["value"].ToString()%>&autoplay=1&margin=3&showstop=1&showvolume=1&showtime=1&showfullscreen=1" />
</object>
any help will be thankfull..
shameer ali shaik