How to insert a link to Youtube video, with preview image shown

I want to make a humorous comment, and make it easy for readers to understand the reference by linking to a youtube video.
But most people won’t want to actually watch the video, and I don’t want to waste people’s time.
To make my point, all I want to show in my post is the opening image of the video , the same image that appears on youtube before you click to watch the video.

In the past, I remember that when I posted a link to a video, the image appears in my post. But this time, Discourse is just showing the text link “https://youtube.com…” in my post, with no graphic.

Is there a setting somewhere that controls this?

(replying to my own thread)
Never mind…the problem corrected itself (well, almost).
While I was typing the post, it showed the link as all text, but when I hit the final send, the link magically turned into an image.
But by mistake, I inserted the link’s address twice, so two identical images appear in my
post.

And here’s the weird part: when I saw the mistake, I immediately tried to edit my own post, but Discourse wouldn’t let me erase either one of the links.

Discourse displayed both links and their images, but when I tried to erase one of the links, it gave me an error message that I can’t embed links.
Even though both links were already embedded.

Discourse has issues embedding youtube videos on this site. IIRC, something to do with the dope not storing them locally. Because of the specific nature of the problem, one of the symptoms is that you can’t edit a post with an embedded youtube video.
From Discoure’s POV, going back in and editing a post with a youtube video is the same creating a new post with a youtube clip, but waiting too long to hit the submit button.

I haven’t tried this yet, but if you were to change the YT link slightly (ie start the clip one second in), it might work.

Test:

Edit: Yes, picking a new start time treats the link as new and allows you to edit the post. I knew that worked for new posts, but I wasn’t sure about editing them…and now I’m changing the start time again, so this edit can go through.

There’s an easier workaround: the first time you edit a post containing the YT link, add ‘&1’ to the link, and increment the number after the ‘&’ for every edit.

To make sure that the YT link with preview goes through in the first place, close the preview pane in the edit window. These are the workarounds that work best and were established in a long thread in “About This Site” when the problem first occurred.

That’s what I typically do (you can see I did it in the above clip).

That never worked for me. I rarely use the preview window and still had problems. Granted, that may have changed since I first learned of the workaround I use (pasting the link and quickly hitting submit), but this way still works. I’ll try just using the non-preview method as my way is a PITA if I want to embed more than one video.

No preview, leaving this up for a few seconds while I type this sentence.

That worked, can I do multiple videos:
Here’s part 2 of that video:

And Part 3:

That’s strange. I shut the preview pane for good after learning the workaround and never had any troubles again posting YT links.

Okay…looks like at least that issue was fixed at some point.

But when was that? I learned/figured out the ‘paste then hit submit right away’ trick a long time ago, so it’s very possible things changed since I had the problem but before you learned of your workaround.

That’s certainly possible, I can’t say when exactly I learned the workaround of closing the preview pane, but I remember the discussion in the “Site Feedback” thread where your method of quickly posting after inserting the link came up some time before someone proposed the other method. I can’t remember when that was (at least half a year ago, I estimate), and if that info was new when I read that thread.

For reference, here’s the thread:

All right, let me see if I’ve learned anything here. Insert the link
(Link removed, can’t embed media links)

No, that didn’t work. Insert the link add &1
(Didn’t work, same error message)

Insert the link with a longer ending than *1
(Ditto)

Insert the link and immediately hit the reply button
(Didn’t work, same error message)

Insert the link on the same line as the post
(Didn’t work same message)

Insert the link except change to youtu.be.com
(Doesn’t work because it says www.youtu.be.com can’t be found)

Insert the link simply using you.be (no .com)
(Nope, youtu.be can’t be found either)

Insert the link with a time code (t= n)
(Doesn’t work, but oddly youtube.com becomes youtu.be)

Insert the link with timecode, but change youtu.be back to youtube.com
(Doesn’t work, but doesn’t give an error message, either. Just the url address)

Type the post in Notepad and then insert it into this post.
(Ditto)

Use the Share function in YouTube and past that url https://youtu.be/WwYkxLZI4Uw?feature=shared

A)that link doesn’t work.
B)Don’t change anything. Just grab the link from the URL or right click on the video and hit copy video URL or copy video URL at current time.
C)paste it on it’s own line without any other text.
D)submit.

Here, copy this and paste it in the reply box all by itself.

https://youtu.be/Cis9szJX8v4?t=14

Nope, doesn’t work. The link won’t even post.

Change the 14 to something else. 20 or 30 should work. I figured discourse would ignore it if it was in a code block. I was wrong.

B)Don’t change anything. Just grab the link from the URL or right click on the video and hit copy video URL or copy video URL at current time.
C)paste it on it’s own line without any other text.
D)submit.

Sorry, that doesn’t work, either.

Can’t embed.

Thanks everyone, but I think I’ve wasted enough of mine and everyone else’s time with this. The link will either work or it won’t and if it doesn’t, I’ll just link to it in the message text.

Don’t overcomplicate things. There is a simple rule that determines if the video can be embedded: has the URL already been displayed as an embedded video on this site? If yes, then you need to change the URL to make it unique.

It seems complicated because there are different ways the video might have already been displayed, and different ways to make sure it is unique. But if you just remember why it happens, it makes a lot more sense.

As for details:

  • Was it displayed in the preview window? Then you’ll get an error. The solution is to collapse the preview window so the posted message is the first time it is rendered. This works well. Clicking submit really quick before it renders sometimes works, but it’s dependent on too many variables and isn’t a reliable way to do it. And it’s not generally a problem if you from your mobile device, where the preview window isn’t displayed by default.
  • Are you editing a post? Then you have to add something to the end of the URL like “?t=0” to make it unique. And if you have the preview window open when editing, you’ll still get an error for the reason above.
  • Has someone already posted that same video? If you get the error and neither of the above two conditions are true, then this is probably the reason. Follow the steps above to make it unique.

Was your preview pane collapsed when you were trying these approaches?

Click that double-chevron in the bottom right corner to collapse it. If you’re seeing the preview for the video, you’ll get an error.