Custom youtube thumnail size - youtube

I'm getting the thumbnail videos from youtube using the image subdomain practically you can get 5 images sizes like:
"http://img.youtube.com/vi/{videoId}/default.jpg"; // Small Default
"http://img.youtube.com/vi/{videoId}/0.jpg"; // Large Default
"http://img.youtube.com/vi/{videoId}/1.jpg";
"http://img.youtube.com/vi/{videoId}/2.jpg";
"http://img.youtube.com/vi/{videoId}/3.jpg";
I'm wondering if there's a different way to get other sizes for the thumbnails beside the defaults

Related

Twitter summary card with large image not showing the complete Image

I am trying to share the following blog post on twitter.
https://theramblingmind.com/2020/06/20/edhayaum-our-thadavai-by-rajesh-kumar/
The shared URL on twitter looks as follows.
https://twitter.com/Jagannathan6/status/1274382615034785792
However, the large image displayed in twitter is cropped and the only the lower half is displayed correctly.
Your image is not in the correct dimensions for a summary large image card:
A URL to a unique image representing the content of the page. You
should not use a generic image such as your website logo, author
photo, or other image that spans multiple pages. Images for this Card
support an aspect ratio of 2:1 with minimum dimensions of 300x157 or
maximum of 4096x4096 pixels. Images must be less than 5MB in size.
JPG, PNG, WEBP and GIF formats are supported. Only the first frame of
an animated GIF will be used. SVG is not supported.
You'll need to provide an image that is in 2:1 (landscape) ratio.

YTPlayerView thumbnail custom size

I am using YTPlayerView library from Google. I want to get the customised size thumbnail of a youtube video for my iOS app.
Can anybody help me how I can achieve this? Current it is giving me the same size thumbnail for a video regardless of the size of my YTPlayerView.
YTPlayerView.load automatically loads its own thumbnail. However, a workaround could be you place a UIImageView on top of the YTPlayerview. And load the customized thumbnail into that UIImageview. You can start playing the video when the UIImageview is clicked using YTplayerview.play. And then hide the thumbnail. In essence, it would give the effect the video is being played upon clicking your customised thumbnail image. You may have to fine-tune some things to make this solution work elegantly.
To retrieve the image for the customised thumbnail, you can use any of 4 generated images of youtube. They are predictably formatted as follows:
https://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:
https://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
For the high quality version of the thumbnail use a url similar to this:
https://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg
I hope this helps to answer your question.

Set iframe size on youtube API

I am trying to tell the Youtube iframe API to set the iframes to be a certain size. I used
[code]player.setPlaybackQuality('large');[/code]
to set quality but it did not set the correct size of the video (even though it says it does). I am not able to specify exact numbers because the size is different for different videos. For example some videos are (560x315, 640x360, etc...) while other videos can have other sizes. How do I set a category of sizes?

embedding youtube videos - aspect ratio

I'm looking to embed some youtube videos in my web page and from looking at the videos on youtube they all seem to be displayed with an aspect ration of 16:9 or 640px:340px.
Trouble is I only have 600px max space to put them in, would I just work out the appropriate height i.e. 640/16*9 = 333px and display them in that and would that take care of everything ,or is there any other size allocated for the progress bar at bottom.
E.g. if you look at this video you can see the progress bar throughout.
http://www.youtube.com/user/southerncomfort?v=ygeWsoYYMuQ
Thanks,
You can use any youtube embed code generator to achieve your goal with ease.
Go to Advanced Youtube Embed Code Generator.
Enter the video ID and input either height or width in the
respective column and hit generate button(the empty field will be
automatically calculated with 16:9 ratio)
Copy the code and use it.
You can choose either 16:9 or 4:3, the later being 480px X 385px (+25px to height for controls).
OR, if you want 16:9, you can choose the size to be 560x315.
Check out the style guide: https://web.archive.org/web/20130415231312/http://support.google.com/youtube/bin/answer.py?hl=en&answer=178264
For anyone still on this,
https://www.w3schools.com/howto/howto_css_aspect_ratio.asp.
Ensure to use ALL CSS PROPERTIES AND STYLING enlisted else it won't render correctly on responsive sites and apps.

YouTube thumbnail link doesn't work in all cases

An application I'm working on needs to get HQ YouTube thumbnails given a URL. Using this answer, I tried using the maxresdefault.jpg to get the maximum resolution of the thumbnail but on some videos (seemingly random), the request 404's.
Here are some examples:
http://img.youtube.com/vi/zIez5QVE3NI/maxresdefault.jpg works
http://img.youtube.com/vi/DaAfe5xTm8w/maxresdefault.jpg doesn't work
Using the same URL's, other requests using the same video keys do work:
http://img.youtube.com/vi/zIez5QVE3NI/default.jpg works
http://img.youtube.com/vi/DaAfe5xTm8w/default.jpg works
Why doesn't maxresdefault.jpg reliably return the image? Both of those videos are public and can be embedded.
I'd use 0.jpg but it has black bars on the top and bottom of the image.
As I understand it, YouTube only generates high-res stills for high-res videos. The first one you link was uploaded at a resolution of at least 1080p, while the second was less than 720p.
Looks like the only thing you can do is pull the video feed, check that to see if a high-res still has been generated and up-scale the smaller one yourself if not.
All¹ YouTube stills are presented in the 4:3 aspect ratio, so will always have black bars at the top and bottom if the video is 16:9. In HTML/CSS, this is easily combated by setting the image as the background of a div and sizing the div to the correct aspect.
¹ Except the mqdefault.jpg stills, which are all in 16:9 aspect (320x180)
Update 2015 :
None of your 'maxresdefault' link seems to be working
Try these:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
Update 2019 ::
https://i.ytimg.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg
Seems to return highest possible image....
1.jpg, 2.jpg, 3.jpg return previews through the length of the clip which are handy also ;)

Resources