/ Published in: jQuery
Lets you get YouTube video scene images by video id or youtube video url using only javascript OR jQuery.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getScreen( url, size ) { if(url === null){ return ""; } size = (size === null) ? "big" : size; var vid; var results; results = url.match("[\\?&]v=([^&#]*)"); vid = ( results === null ) ? url : results[1]; if(size == "small"){ return "http://img.youtube.com/vi/"+vid+"/2.jpg"; }else { return "http://img.youtube.com/vi/"+vid+"/0.jpg"; } }
URL: http://jquery-howto.blogspot.com/2009/02/how-to-get-youtube-video-screenshot.html