Users report that YouTube video thumbnails in Discourse do not update when lazy loading is enabled, even after the original video’s thumbnail changes on YouTube. AquaL1te notes that disabling lazy loading and rebuilding the post’s HTML forces a refresh, suggesting a caching issue within Discourse. jancernik explains that lazy loading fetches thumbnails via img.youtube.com/vi/id/maxresdefault.jpg, which YouTube updates infrequently and unpredictably — sometimes taking up to 30 minutes. Even when new topics are created, old thumbnails persist, implying Discourse may cache them. AquaL1te confirms thumbnails update on YouTube’s side but not in existing topics, even after re-enabling lazy loading. AquaL1te reports the issue persists for new topics too, and manually rebuilding HTML or adding/removing links doesn’t help. patrickemin and benjamincfarmer corroborate the problem on hosted sites: editing a post shows the new thumbnail in preview, but the actual post retains the old one unless the onebox is manually refreshed — which requires clicking the play button, not just editing. The consensus is that Discourse’s lazy loading mechanism lacks a reliable thumbnail refresh mechanism, and users are requesting a fix.
When I disable lazy loading YT videos and trigger a HTML rebuild of the particular post, then the thumbnail is refreshed. But when enabling it again and rebuilding the HTML I get to see the old thumbnail again.
Is there a way to clear the tumbnail cache of one video? Or is there a way to set/check the refresh period?
This is more related to YouTube than anything else. When you disable lazy loading, the video iframe gets embeded directly which has direct access to YouTube’s API each time it get loaded.
For lazy loading, we fetch the thumbnail from img.youtube.com/vi/id/maxresdefault.jpg instead. There are multiple image sizes, but YouTube is not very clear on how they update these URLs. We use maxresdefault, which is the largest image they provide and, from my testing, is the one that usually takes the longest to update. In my case I found that thumbnails took anywhere from 1 to 30 minutes to get updated.
And to answer your last question, no, there is no way to set a refresh period. Thumbnail updates are not very frequent, so we don’t have a job that periodically updates them.
The thumbnail is updated on the YouTube side. In new topics it loads with the new one, but in the original topic it keeps reverting to the old one. As if Discourse has a cache. It even happens to this day
My quick fix now is to disable lazy loading, rebuild the HTML of the topic, it gets the new image, but less efficient. Then I enable lazy loading again and don’t touch the topic anymore.
This is still an issue, also with new topics. Thumbnails are never updated, even if the YouTube video gets a new thumbnail. Removing the links, rebuild HTML, add the link again, all doesn’t matter. It forever keeps the old thumbnail. Can this be fixed please?
I’m seeing the same thing on a hosted site as well. Changed the thumb on YT but onebox is not updating.
If I attempt to EDIT the post the preview shows the new thumb but doesn’t force the update on the post itself.
If I tap/click the onebox in the post without hitting the play button, it updates the image to the new thumb, but only during that viewing of the post. A refresh returns to the old image.