Javascript - Detect Youtube Default-Thumbnail

Is there a way to see if the Youtube thumbnail actually exists, or if Youtube just replaced it with the default icon?

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

History: I was just trying to use Youtube maxresdefault-Thumbnails as the background for my "Media-Player-Page". Using regular images works great, but for any kind of processing, some Youtube videos don't have maxresdefault-Thumbnail. If I load this image, I just get a small default thumbnail which is not very nice on a FullHD screen.

+3


source to share


1 answer


Instead of showing the default image, you can 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 can compare the Base64 encoding of each image as defined in this answer: Get image data in JavaScript?

+1


source







All Articles