Bind datalist to the Video url
string selectSQL = "SELECT Video_Name,url FROM media";
SqlConnection cnn = new SqlConnection(connectionString);
SqlDataAdapter adp = new SqlDataAdapter(selectSQL, cnn);
DataSet ds = new DataSet();
adp.Fill(ds);
DataList1.DataSource = ds;
DataList1.DataBind();
use datalist item command
protected void DataList1_ItemCommand1(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "select")
{ embed1.Attributes.Add("src", @"http://~/Uploads4/");
embed1.Attributes.Add("filename", Server.MapPath(e.CommandArgument.ToString()));
}
}
use the embed tag to built media player
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="Player1">
<param name="URL" value="http://localhost/Music.wmv">
<param name="http://path_to_the_video">
<param name="AutoStart" value="1">
<param name="ShowControls" value="1">
<param name="ShowStatusBar" value="1">
<param name="ShowDisplay" value="1">
<param name="stretchToFit" value="1">
<embed runat="Server" id="embed1" type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
width="424" height="379"
autostart="1" showcontrols="1" showstatusbar="1">
</embed>
</object>
</param></param></param></param></param></param></param>
it is the code that i have used.
hope it helps you also