Click here to Skip to main content
15,895,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I already uploaded video files to my project .now i want to play it.how to do it ..plz give idea about it.

Thanks in advance
Posted

Bind datalist to the Video url
C#
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
C#
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
ASP.NET
<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
 
Share this answer
 
v2
Comments
amritha444 20-Sep-11 5:16am    
hi Uma
i tried your code..but the viedo didnt plays..what may be the reason
amritha444 20-Sep-11 7:52am    
no problem...its working fine now..
thank you
Hi,

There are so many ways to play videos on your web application.
that is based on which format you are using for your videos.I prepered use .swf
files to play videos.B'coz these extenssions are easy to transfer.

Here 'm providing some links to reffer playing video on website

http://www.codeproject.com/KB/aspnet/playSwf.aspx

and

http://www.aspnetflashvideo.com/

And If you use Ajax flash controls it is better than others.Eventhough you are using lower versions also.


All the Best
 
Share this answer
 
Hi,

You can use this plugin-
http://jquery.malsup.com/media/video.html[^]
 
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