Click here to Skip to main content
Sign Up to vote bad
good
See more: ASP.NET
How to play a video in asp.net web site by fetching path from database.
Posted 22 Dec '12 - 0:19
ntitish970
Edited 31 Dec '12 - 19:54


4 solutions

http://forums.asp.net/t/1372384.aspx/1[^]
 
//IN FRONT END
string sqlqueryPlayVideo = "Alumniproc";
                DataSet dsPlayVideo = DBManager.DataAccess.getdata(sqlqueryPlayVideo);
                if (dsPlayVideo.Tables[0].Rows.Count > 0)
                {
                    string path = Server.MapPath("~/");
                    string VideoPath = path + dsPlayVideo.Tables[0].Rows[0]["Gallery_Content"].ToString();
                    if (VideoPath != null)
                    {
                        string fileextenction = "";
                        if (VideoPath.EndsWith(".wmv"))
                        {
                            fileextenction = Path.GetExtension(VideoPath).ToLower();
                            //file.Attributes.Add("value", VideoPath);
                            this.paramMediaPath.Attributes.Add("value", VideoPath);
                        }
 
                    }
                }
//AT BACK END
<object id="MediaPlayer" width="690" height="300" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
        standby="Loading Windows Media Player components..." type="application/x-oleobject">
        <param name="FileName" id="paramMediaPath"  runat="server" />
        <param name="ShowControls" value="true" />
        <param name="ShowStatusBar" value="false" />
        <param name="ShowDisplay" value="false" />
        <param name="autostart" value="false" />
        <embed type="application/x-mplayer2"
 
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/" 
 
width="424" height="379" src="ccent31.wmv"
 
filename="ccent31.wmv" autostart="0" showcontrols="0" showstatusbar="0" showdisplay="0">
 
</embed>
    </object>
  Permalink  
  Permalink  
Comments
__TR__ - 22 Dec '12 - 6:25
+5
ProgramFOX - 22 Dec '12 - 6:26
Thank you!
ntitish - 22 Dec '12 - 7:42
Download flash web control from http://www.aspnetflash.com/ . Just add that in to your tool box by right clicking on tool box items and clicking on choose items. If u have already added the tool then select it else browse for dll file and add that... Now ur tool box contain flash video control that can play flv or swf files.. jus asign Flash1.MovieURL = "Path of video file from u tube";//Here flash1 is id of flash control This will work, if not please let me know... I have taken a data list which displays name of video, description and link button from database..If i click on see video link that will play video in flash control If u are using only videos from youtube but not playing any videos from ur server or anywhere else u can use following code protected void lnkSeeVideo_Command(object sender, CommandEventArgs e) //lnkSeeVideo_Command is event of item template(link button) that is in data list-- { try { string str = Convert.ToString(e.CommandArgument);//str is video id string of a video that is in youtube --- which is fetched from database lblVideo.Text = string.Format("<div id=\"video{0}\"><object width=\"491\" height=\"343\"><param name=\"movie\" value=\"http://www.youtube.com/v/{0}&rel=1\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/{0}&rel=1\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"491\" height=\"343\"></embed></object></div>", str); ///We are embedding youtube flash video at runtime in a label, this worked fine for us. } catch (Exception ex) { } } this was the solution i got from one site...www.aspnetflash.com in this web site flash should not used for comercial purpose..i want which will be the good player will set in asp.net
Abhishek Pant - 22 Dec '12 - 10:08
follow which one you find best and easy.
  Permalink  
Comments
__TR__ - 22 Dec '12 - 6:25
+5
Sandeep Mewara - 22 Dec '12 - 6:28
Thanks.
ntitish - 22 Dec '12 - 7:42
Download flash web control from http://www.aspnetflash.com/ . Just add that in to your tool box by right clicking on tool box items and clicking on choose items. If u have already added the tool then select it else browse for dll file and add that... Now ur tool box contain flash video control that can play flv or swf files.. jus asign Flash1.MovieURL = "Path of video file from u tube";//Here flash1 is id of flash control This will work, if not please let me know... I have taken a data list which displays name of video, description and link button from database..If i click on see video link that will play video in flash control If u are using only videos from youtube but not playing any videos from ur server or anywhere else u can use following code protected void lnkSeeVideo_Command(object sender, CommandEventArgs e) //lnkSeeVideo_Command is event of item template(link button) that is in data list-- { try { string str = Convert.ToString(e.CommandArgument);//str is video id string of a video that is in youtube --- which is fetched from database lblVideo.Text = string.Format("<div id=\"video{0}\"><object width=\"491\" height=\"343\"><param name=\"movie\" value=\"http://www.youtube.com/v/{0}&rel=1\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/{0}&rel=1\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"491\" height=\"343\"></embed></object></div>", str); ///We are embedding youtube flash video at runtime in a label, this worked fine for us. } catch (Exception ex) { } } this was the solution i got from one site...www.aspnetflash.com in this web site flash should not used for comercial purpose..i want which will be the good player will set in asp.net
  Permalink  
Comments
ntitish - 22 Dec '12 - 7:44
in the above comment i asked the question....can u give me any solution for that..
Abhishek Pant - 28 Dec '12 - 20:52
I think the youtube link you provided will work on runtime from the internet or you have to save your videos in your database.here is a player for every brower support Flash Video Player[^] or why dont you directly embed your videos to play in there..!its easy you can use flash banner tool

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 611
1 Maciej Los 265
2 Slacker007 240
3 CPallini 235
4 OriginalGriff 210
0 Sergey Alexandrovich Kryukov 9,118
1 OriginalGriff 7,134
2 CPallini 3,803
3 Rohan Leuva 3,135
4 Maciej Los 2,558


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid