Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
How to play a video in asp.net web site by fetching path from database.
Posted 22-Dec-12 0:19am
ntitish1.4K
Edited 31-Dec-12 19:54pm
v3
Comments
Member 10208230 at 27-Feb-14 4:52am
   
It's giving error at DBManager as
 
The name "DBManager" does not exist in the current context
 
why??
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
__TR__ at 22-Dec-12 6:25am
   
+5
ProgramFOX at 22-Dec-12 6:26am
   
Thank you!
ntitish at 22-Dec-12 7:42am
   
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 at 22-Dec-12 10:08am
   
follow which one you find best and easy.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Comments
__TR__ at 22-Dec-12 6:25am
   
+5
Sandeep Mewara at 22-Dec-12 6:28am
   
Thanks.
ntitish at 22-Dec-12 7:42am
   
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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  
Comments
ntitish at 22-Dec-12 7:44am
   
in the above comment i asked the question....can u give me any solution for that..
Abhishek Pant at 28-Dec-12 20:52pm
   
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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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  
v3

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 288
1 _Amy 270
2 Maciej Los 220
3 Manfred R. Bihy 200
4 CHill60 180
0 OriginalGriff 7,445
1 Sergey Alexandrovich Kryukov 6,347
2 Maciej Los 3,799
3 Peter Leow 3,558
4 CHill60 2,702


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 30 Oct 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100