Sometimes I’m able to include a link to a YouTube video in a thread. These are plain unformatted URLs, and they are typically converted to a preview with summary by the software which is super helpful.
Other times when I include a YouTube link, I get an error when trying to submit the post. The error says “An error occurred: Sorry, you can’t embed media items in a post.” and that blocks you from submitting the entire post unless you remove it. There is no way that I can figure to bypass that error by removing the auto-generated preview (which I assume is the source of the issue). I’m obviously not using an embed tag or anything comparable. The only option is to convert the link to a formatted link using the editor which then omits the preview and summary and obscures the destination of the link from the reader.
I assume this is a transient bug in the software, but I’m curious is anyone has any workarounds or info about it.
For testing purposes, this is the link that’s currently triggering the error.
It’s not about the preview (or lack thereof), it’s about how long that link is sitting there before you submit the post. IME, if you don’t hit the post/reply button within a few seconds, the youtube link won’t work, ever. If/when that happens, slightly adjusting the URL (ie appending a suffix so it starts at the 1 second mark) will ‘fix’ it, but you still have to be quick about it.
What works best, at least for me, is to write your post and after you’re done, then paste the youtube link and hit submit right away. If there’s more than one youtube link, write the post (or at least the part with the links) in a different program, then paste the whole thing here and hit submit, again, right away.
Hiding the preview prevents Discourse from generating the thumbnail for the video, which is the real cause of the bug. Hiding the preview didn’t work for Omniscient because they already tried to post the video. Discourse did its thing and broke that specific URL forever. But you can generate an infinite number of variations by appending &1, &2, etc.
If you are the first to post a video, then hiding the preview will work and you don’t have to be quick about it.
Maybe for you, not for me. I rarely have the preview window on (and never while I’m typing) and I have the problem with youtube links all the time. At least for me, the youtube problem is unrelated to anything involving the preview window.
It’s not completely impossible that some browsers might render the preview even when hidden. That would depend on how the preview is hidden and how the browser behaves.
But Joey_P tried it above on a fresh video and it worked as I described. So I expect that the seeming variability is just due to some other effect, like the video having already been posted by someone else.
It took us a while to figure out the bug due to everyone having a slightly different experience, not to mention misreporting. But I am very confident now that it works as I described in the link above.
It’s the same in Chrome and Edge in Windows, as well as Safari on iOS. Oh and Edge and Chrome in Android also, based on my experience at least.
I have not tested in Firefox since I haven’t used that browser for many years, so it’s possible that it works different on it. Or Opera, which I haven’t used in more than 20 years (and that was on Mac OS X, before Safari even existed, heck even Mozilla didn’t exist yet).