YouTube thumbnail link doesn't work in all cases - youtube

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 ;)

Related

Any way to restrict the full resolution image from being served up with Imageprocessor in Umbraco?

I'm working on a photography website in which full resolution photos can be uploaded but full-res should not be able to be displayed/accessed (download of the full res will take place through a token.)
I've tried the "restrictTo" setting but resolutions need to not be reliant on specified dimensions.
Is there a way to have myphoto.jpg by default without a querystring display at for example 700x700 yet still have the full resolution file available through a token download? Pretty much, an image without a querystring is still processed by Imageprocessor but with a default resize rule.
I can request an image with a native width of 5000px by myphoto.jpg?width=1400 but the resulting image is the full 5000px width image, why doesn't the max width 1400px image serve up?
If you are getting the full image back it means something has gone wrong. (You've probably ran out of contiguous memory) so make sure you're in 64bit mode.
maxWidth restricts the resize param to an upper limit only. So does nothing on it's own.
What you are probably looking for is the ValidatingRequest event
http://imageprocessor.org/imageprocessor-web/imageprocessingmodule/#events
I would first set ImageProcessor.Web to intercept all image requests in the processing.config file by changing the interceptAllRequests property. That will ensure you capture any attempts to view the image without a token.
In the event you can cancel the request and also alter/add any querystring parameters to limit your size transparently without showing the querystring to the end user.
I would use a query string for the image.
url?width=1400&height=900&mode=crop&anchor=center
I would also use a lazy load so the page loads faster with small blurry images and then afterwards replaces them all with the full res or querystring for max size you want to display at.
I wrote a script for this.
http://www.codeshare.co.uk/blog/lazy-loading-images/
Also on my site now, when I upload an image, I automatically resize it down to 1080p resolution when it saves. So I can upload a massive image and not have to worry about resizing it first or it taking up too much space on my server.
Here's the code for that too
http://www.codeshare.co.uk/blog/automatically-resize-your-media-images-in-umbraco/

colorbox FULL SIZE Images

I'm NOT a programmer, just like to play with php, pictures, movies & music.
Being creative. I'm making a site with OSCommerce 234BS? It's working well just the colorbox is'n what I want. I have pictures in high quality and would like the visitors could watch them FULL SIZE, like when you click right on a picture & open it in a new window, because then you have also a zoom function.
See pictures
Thanks a lot for supportenter image description hereenter image description here
I would like my bxgallery is like you can see on ebay. Mouse ober and click for larger image. Then you see the images expanded over the whole screen.

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.

Embedded Youtube: How to get high quality on iOS 7 ipad

I have an embedded youtube video on a web page. On the desktop it works fine. However, on an ipad (running iOS7) the video quality is rather poor, probably 480p. Inside the iframe it looks fine, but when you make the video full screen it is very noticeable. I have tried using hd=1&vq=hd720 in the querystring and using cueVideoById with a suggested quality of 'hd720' but neither worked. Are there any work arounds either to get higher resolution on the ipad when embedded youtube videos are made fullscreen, or to force higher resolution for embedded youtube videos on the ipad?
I found a workaround that works, although it is hardly elegant.
Basically, I create the iframe with a dimensions large enough to get 720p quality. (Such as making the iframe 720x440 pixels.) And then, I use CSS transforms to scale the iframe back down to the size I want. The CSS looks something like:
-webkit-transform-origin: left top;
-webkit-transform: scale(0.5);
Where 0.5 could be replaced with whatever scale you had to increase the size of the iframe by.
The main downside to this from the user's perspective is that the video controls are scaled down. However, in full screen mode the controls are the normal size, and the user can pinch out to full screen, so for my team at least the trade-off in increased video quality was worth it.

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.

Resources