2
votes

I'm loading few videos with iframe on a page. Those videos have custom high Quality thumbnails that we've uploaded in youtube. We have the player in 1280px wide and it for the most of the time it doesn't load the max res thumbnail, but it goes for a low quality thumbnail.

So far I've been unable to understand how youtube decides which thumbnail to load. For the last couple of days it was loading the high quality thumbnail in firefox & IE, but it was taking the low resolution for chrome. Today it is the same in all browsers -> it loads the low quality image.

If you want to see it for yourself here is the site: http://wingtsun-akademie-heidelberg.de/new/

I've tried to force hd quality with the js iframe api:

  player = new YT.Player(el, {
    height: 1080,
    width: 1920,
    hd: 1,
    events: {
      'onStateChange': onPlayerStateChange
    }
   });

But it doesn't seem to have any effect? Do you have any idea if I can load a custom thumbnail by providing it to the player object?

Right now it seems that youtube loads most of the time: http://i3.ytimg.com/vi/WqK2IlP-JSE/hqdefault.jpg instead of: http://i3.ytimg.com/vi/WqK2IlP-JSE/maxresdefault.jpg

Thanks in advance for any suggestions.

2

2 Answers

1
votes

this is what youtube API states for maximum resolution thumbnails:

maxres – The highest resolution version of the thumbnail image. This image size is available for some videos and other resources that refer to videos, like playlist items or search results. This image is 1280px wide and 720px tall.

Important is the quote "available for some videos". So NOT at all EVERY youtube video serves a maxres thumbnail to third parties.

The reason for this is unknown. Seems as if the availability of maxres thumbnails comes randomly. I have hand-checked maxres thumbnails for several thousand youtube IDs and couldn't find a pattern. Some have maxres and round-a-bout at least a third of all videos checked just don't serve a maxres whatever the resolution of the video is. So one has to assume Youtube is willingly annoying third parties for a reason. You may speculate yourself why 'they' are doing this...one might think it's one of the easiest things to always generate a maxres pic for every video. But...they don't let their system generate them.

0
votes

Your website seems to be using the right thumbnail now... I guess your problem is fixed?

YouTube recently changed the way thumbnail ids are retrieved. It is now using a key-value map rather than a list, which means you can now longer rely on the first one being this size etc... so maybe that was a problem with this, if you switched the API level from 2 to 3.