Embedding YouTube


(Vin) #1

I have a specific question regarding YouTube videos that I haven’t so far seen answered in any posts on this forum.

We use the Onebox feature to embed YouTube instructional videos into our posts on Discourse so that our users can see how to use our products. The only problem with this is that at the end of the video, YouTube will show links to recommended videos, which are often inappropriate for our audience or promotional videos for competitors. We’d like to use embed codes from YouTube to disable recommendations (and video titles and player actions), but I haven’t been able to find a way of getting the embed links from YouTube to display an embedded video in our posts.

What am I doing wrong here? Is the functionality I’m looking for something that exists in Discourse (v1.4.0.beta6 +79)? I tried looking through the Admin setting for embedding but was unable to make it work, even though I added youtube.com and www.youtube.com to our list of embeddable hosts. Currently, I paste the embed link into a post and it removes the text form the post so that it won’t even display as plain text.

First post on these boards and I have only been using Discourse for two weeks so apologies if this is a silly question!

(Kane York) #2

This would need a patch to the Onebox code… I think I can do it.

(Vin) #3

Thanks Kane! That’s very helpful.

(Kane York) #4

Hmm, I just looked at the embedding documentation and it looks like they have quietly removed the ability to turn off suggested videos at the end? Or I was mistaken & it was never there.


(Vin) #5

Seems like it’s still there in the YouTube UI

(Kane York) #6

the rel=0 parameter is what you want

(Alan C. Oehler) #7

Hmmm… I just tried appending the URL with ?rel=0, and I still see related videos displayed at the end.

(Simon Cossar) #8

It seems like it can be made to work. Here’s a YouTube video about it: How to stop YouTube from showing related or recommended videos after your video (2014 \/ 2015)

For this to work with the YouTube onebox it needs add rel=0 to the embed params. Just adding ?rel=0 to the URL doesn’t work.

(Kane York) #9

Yeah, a patch to the onebox code is needed to pass the rel=0 all the way through.

Passing through rel=0 on YouTube embeddings