Skip Navigation LinksHome > Categories > Code from a Category

Play Youtube video from your website using video link only - in asp.net



User Name: jamest85
Name: James Tang
Contact Me: www.datawebcoder.com/ContactUs.aspx
Home Page: www.datawebcoder.com
Google Apps for Work Partner, Certified Zoho CRM Consultant. 7 years experience on Zoho consulting, implementation, and programming using C#, VB, Php..., 15 years of total IT experience including prog... [More]
Viewed Times: 9968
Add Date: 03/05/2010
This post shows how to add a Youtube video links to your website, and visitors can view the video from your site without uploading the video file.
From this website, you can view youtube video directly, that doesn't mean we need the real video file to be saved in this site, in fact we only need a youtube video link, such as: http://www.youtube.com/watch?v=Dh2wLs7YP7E&feature=sub

What we did here is:
1. Allow users add their youtube links to this website database.
2. Write a small function and grab the link from database.
3. Show and play the video on this website.

First: Create a User control: VideoWindow.ascx , there is only a Div with Id. Second: in VideoWindow.ascx.cs: Third: Lets use the control on .aspx page: In the above code, we defined sHeight, and sWidth values; the getLinkPath("CodeId") is nothing but a funtion in code behind to get the correct URL, let me know if you have any question on this.

Forth: In code behind (aspx.cs) page, get the Youtube video links from database, and bind to above DataList control: Fifth: getTopNNewVideos() is a function to get the data from database: Last: The stored procedure is: Note: There are some hard coded number in code, please change it accordingly.

That is it, if you have any question or comment, please let me know.
praba
Comment #:  16 Replay this Comment Reply this comment Posted on: 7/15/2011

 sir, 

 i want rotate image in asp.net with c# coding . that image get from database stored image. then i need video loading play that video in aspx page. plz help me.. if u r accepted this ;

          by 

  praba

 

Comment #:  17 Replay this Comment Reply this comment Posted on: 7/16/2011

 Hi: Proba

Thanks for your message.

Can you please contact me at info@datawebcoder.com for further discussion? 

Thanks

James

 

 

praba
Comment #:  18 Replay this Comment Reply this comment Posted on: 7/18/2011

Reply to Comment #:17

Hi: jamest85

I want to play video in aspx.page then i stored youtubc video url in sql server database. then i retrieve video url to play in aspx. page. plz rly to me .

           

Comment #:  19 Replay this Comment Reply this comment Posted on: 7/18/2011

Reply to Comment #:18

Hi: praba

The above code is good enough to let you start, try to may a simple html string that can show any one of youtube video by it's id. if that works, then rest of thing just about getting data from your database.

I am not sure if you are a programmer or not, if yes, then shouldn't be too hard, if not, then contact me at info@datawebcoder.com

Thanks

James

madan
Comment #:  59 Replay this Comment Reply this comment Posted on: 5/11/2012

hi sir,

 This is madan.your articles are very nice.may i get above artilce code files and database structure...please.if possible please send the .rar file to my email:madhan2008@gmail.com

 

Thankyou

Anubhav
Comment #:  84 Replay this Comment Reply this comment Posted on: 7/21/2012

Hi: jamest85

I want to play youtube url on my aspx page bt the problem is that embedded tag does not accepting complete url of video bcz that accepting only video Id of video....plz help me out

Comment #:  85 Replay this Comment Reply this comment Posted on: 7/21/2012

Reply to Comment 84

Hi: Anubhav

I am not sure what is the difficulty you have, pls explain more

thanks

keyur
Comment #:  134 Replay this Comment Reply this comment Posted on: 3/1/2013

hi sir...

i have to give facility to user that user will upload there videos to my website using youtube.user just have to give url of that video and it shoud be store in my in my database and at there home page it will be display all the video that user have uploaded to my website.all entry of url are going to my database curectly but i don't know how to list there video and when user click on it how to play to diffrent page..please sir help me to solve the problem.

 

Comment #:  135 Replay this Comment Reply this comment Posted on: 3/1/2013

 Hi: KeyurThe above code is good enough to let you start, try to make a simple html string that can show any one of youtube video by it's id. if that works, then rest of thing just about getting data from your database.

Try it by yourself no matter how many hours you spend, you will be rewarded if always solve issueses by yourself :)

 

Comment #:  159 Replay this Comment Reply this comment Posted on: 11/1/2013

Hi i have tried your code but i want to know where to specify yournamespace in web.config file

Post a Comment

Name: (Optional)
Email: (Optional, you can get an email if somebody replys your comments)*
Email me if somebody respons my comment below:
Details**:
Enter Text
as Below:
(case insensitive, if hard to read, click the "get a new one" button)
 
    
* Your email address will not be shared with any third parties for any reason.
** Maximum 1000 charactors.