My YouTube videos look small and have a black border, and I don’t know how to change the width and remove the border. I have read your response, but don’t understand what to do. I was wondering if you could explain it to someone who has no clue about this type of thing.
What I posted is custom CSS, which you can add by going to Admin > Customize, and then adding that to a theme or theme component by clicking “Edit CSS/HTML” and pasting into the Common > CSS section.
If you don’t already have a custom theme, I think you can either add the CSS directly to your default theme, or make a new theme component, add the CSS there, and then make sure that component is added to the main theme.
This may sound confusing if you’re not yet familiar with Discourse themes / customization at all. Give this a read for more detail and it should start to make sense how it all works! —
That guide is just background reading if you get lost, but you should basically be able to just copy-paste that code to your theme and have it work.
You may be able to pass the width/height params as part of the YouTube URL (as per this post), but this customization is currently needed to change the default way Discourse displays YouTube videos.
I do agree Discourse could handle this better by default though so this customization isn’t needed! @Johani would you consider making this the default for video embeds? Would make for more consistent design (e.g. I believe oneboxes, large images, etc. always display full-width…)
I am still unsure how to adjust the height and width of an individual post. I can see that it should be 690 & 400, but my link (for an unlisted YouTube video) doesn’t contain height or width like it does in the example you sent me.
Hmmm just tested and it looks like that method still works? You just append &width=690&height=400 to the first part of the URL e.g. https://www.youtube.com/watch?v=4CJvasYJP6o
But yeah you’d have to do this for every single video so the method above is definitely better to have consistent video display for the whole forum e.g. if any other users besides yourself may be posting video links.
If you want all videos to display this way, I highly recommend not adjusting the URL for individual videos, and using the above CSS modification instead.
As mentioned above just go to Admin > Customize > Themes and paste that snippet into your CSS (more modular if it’s in a component, but works fine to add to your main theme too). Should only take a minute. I don’t think there’s a simpler way to do this.
The real “easier” solution here would be for Discourse to make this the default. Most embeds (large images, oneboxes, GitHub code embeds) display full-width and making video embeds behave similarly would look better + be a lot more visually consistent.
That was last year, not sure if the Discourse team may have any new thoughts on YouTube size. But yeah this comes up fairly often and I’ve learned that making this the default in Discourse core is certainly a bit trickier problem than it would seem
All that’s kind of academic though, the short story is you can paste in the above snippet in literally like 30 seconds and have glorious full-width YouTube videos on your site!
I don’t think anyone wants Discourse to be a “video distribution system”, but if you’re gonna allow videos to be shared & discussed — very important for many forums, ours included — they should look good. And yes by “good” I mean “spanning the full post width to optimize space just like other Discourse embeds do” but I guess we can agree to disagree
If you prioritize looks over the benefits of LazyYT (blocks Google tracking every user since it doesn’t load the full iFrame, the page isn’t as heavy for the same reason) you can just delete the lazyYT from the plugin folder and it will fallback to standard oembeds:
I spent way too much time researching YouTube APIs, and in order to make LazyYT use better thumbnails (which can fit our 690px post width) we would have to ask every admin to signup for Youtube API keys, implement logic of falling back to the current thumbnails since old youtube videos doesn’t have HD thumbnails and it wasn’t really worth the effort. So if you just want it to look cool, just run a simple rm -rf plugin/lazyYT in the run hook in your app.yml.
Totally #pr-welcome if someone who cares about this and want to implement a better thumbnail logic to LazyYT which accounts for all the cases:
Admin doesn’t have an API key configured
API key is invalid
Video is too old
Video has thumbnail, pick the higher resolution one (maybe make it configurable so people can match their forum width)