Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript - Detect Youtube Default-Thumbnail

Is there any way to see if a Youtube Thumbnail really exists or Youtube just replaced it by the default thumbnail?

For example, a video without this thumbnail : http://img.youtube.com/vi/G75WApUdYJ4/maxresdefault.jpg And one with an existing thumbnail : http://img.youtube.com/vi/pkyLAWX5V30/maxresdefault.jpg

Story: I just tried to use Youtube's maxresdefault-Thumbnails as background for my "Media-Player-Page". Using normal images works fine but for any reasom some Youtube Videos don't have a maxresdefault-Thumbnail. If i load this image I just get the small default Thumbnail which isn't really enjoyable on a FullHD Screen.

like image 287
cybrox Avatar asked Nov 13 '22 11:11

cybrox


1 Answers

Rather than serving up the default image, you could use 0.jpg, 1.jpg, 2.jpg, or 3.jpg (see How do I get a YouTube video thumbnail from the YouTube API?).

If that doesn't work for your needs, you could compare the Base64 encoding of each image, as defined in this answer: Get image data in JavaScript?

like image 155
Ian Hunter Avatar answered Nov 15 '22 11:11

Ian Hunter