Click here to Skip to main content
16,012,046 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
i want to show image of you tube video URL on my application based on url copied from youtube.

How can i do this.
Posted

You will need to either create the thumbnail yourself (would get old) or use this solution (recommended) as shown here:

Alternative to YouTubes Video API to get video thumbnail[^]

Thought I would add and example of how this might be done.

e.g.
your video link:
http://www.youtube.com/watch?v=OSUO0Rgfo1w&feature=related

so with this particular video link and possibly all youtube links you could do something like this to create the image link.
e.g.
In C#
C#
string videoLink = "http://www.youtube.com/watch?v=OSUO0Rgfo1w&feature=related";
string imgLink = "http://img.youtube.com/vi/";
string[] temp = videoLink.Split(new char[] { '=', '&' });
imgLink = imgLink + temp[1] + "/2.jpg";


or VB
VB
Dim videoLink As String = "http://www.youtube.com/watch?v=OSUO0Rgfo1w&feature=related"
Dim imgLink As String = "http://img.youtube.com/vi/"
Dim temp As String() = videoLink.Split(New Char() {"="c, "&"c})
imgLink = imgLink & temp(1) & "/2.jpg"


would give you your image link:
http://img.youtube.com/vi/OSUO0Rgfo1w/2.jpg
 
Share this answer
 
v10
Comments
thatraja 7-Nov-11 11:03am    
Nice alternate, 5!
LanFanNinja 7-Nov-11 12:02pm    
Thanks!
LanFanNinja 7-Nov-11 13:13pm    
In case anyone notices this is version 10 of my solution it is for lots of reasons but mostly because of minor brain malfunctions (I have not slept in 36 hours). :)
Uday P.Singh 7-Nov-11 13:28pm    
worth a 5 for version 10 :)
LanFanNinja 7-Nov-11 13:40pm    
LOL! Thanks.
 
Share this answer
 
Comments
prathamesh812 7-Nov-11 7:19am    
No i dont want to play video in my application.The thing is,if i like any video from You tube,i copy that URL and add in my application so based on that URL i just want to show the picture which is available in You tube.And when i click on that picture will redirect to you tube .
thatraja 7-Nov-11 7:21am    
Did you see the screenshot in that article? It shows the same.

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