Return to Snippet

Revision: 12564
at March 19, 2009 07:23 by Uzbekjon


Initial Code
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";
  }
}

Initial URL
http://jquery-howto.blogspot.com/2009/02/how-to-get-youtube-video-screenshot.html

Initial Description
Lets you get YouTube video scene images by video id or youtube video url using only javascript OR jQuery.

Initial Title
Get YouTube video thumbnails URL with jQuery

Initial Tags
javascript, jquery, api

Initial Language
jQuery