When oembed url is passed without size attributes, Vimeo thumbnail can be very low resolution
It seems that Vimeo expects width and height attributes and otherwise returns a thumbnail that may be quite small. In my case, I have a video that is 945x wide, but the thumbnail Vimeo sends back is 295px wide—and so it looks very bad.
I've had a quick look at the code and it isn't apparent to me where this is being set or not set. If you could point me in the right direction, I could try to add some code to make it possible to get higher resolution thumbnails from Vimeo.
You can check this part of the code: https://github.com/kevinweber/lazy-load-for-videos/blob/master/src/frontend/lazyload-vimeo/lazyloadVimeo.js#L19 And then the background size is being set based on the thumbnail type that was selected on the admin page: https://github.com/kevinweber/lazy-load-for-videos/blob/5e91dcd20dd8e3fd398289571186d7a153071002/src/php/static-styles.php#L66
Hmmm, I wonder why Oembed is pulling a tiny thumbnail in some cases. I'm guessing it's because the size isn't specified (e.g. using width=100%) because when I try directly at https://vimeo.com/api/oembed.json, I get a pretty small thumbnail (around 200-300px) if I don't specify a width. But in any case, as I understand it, Vimeo is always going to give you the next smallest size thumbnail via Oembed, which seems less than ideal in this case.
So I think instead of grabbing the thumbnail from the existing Oembed, it could grab: https://vimeo.com/api/oembed.json?url={video URL}&width={adjusted width of element} and pull out the thumbnail URL from the response.
Adjusted width of element: Based on the image thumbnail sizes given by Vimeo (under Using the sizes parameter), you could figure out which size to request to make sure the thumbnail is roughly the same size as the element width or larger (e.g. to prevent a 600px wide embed from showing a 295px wide thumbnail).
Make sense?
If you insert the video via URL, the thumbnail is blurry most of the times. The simplest solution to this would be adding a select box to the Vimeo settings with 480p, 720p and 1080p.
I'm happy to take a stab at a patch with my proposed solution above, if it makes sense to @kevinweber.
@larssandergreen If you want to give it a try that would be great. I can't work on features right now but I'm happy to review & publish your change
I found a simpler solution that just uses a full size preview image from Vimeo. Maybe that's not ideal in all cases, but it's probably a significant improvement. Maybe in the future I can come back to this and implement the solution I wrote about above, but for now this seems like a significant step in the right direction.
Thanks @larssandergreen for your contribution. I commented on your PR (https://github.com/kevinweber/lazy-load-for-videos/pull/55#issuecomment-822051321) and followed up with some more changes here: https://github.com/kevinweber/lazy-load-for-videos/pull/57
I just published the changes with plugin version 2.15.0. Please let me know if that solves the issue discussed in this thread.