I had some people ask me over the weekend how they could hide some related videos on a video they had embedded from their YouTube account. In case you are unfamiliar w/ Related Videos, these are the squares w/ links to other videos that pop-up once you have watched a YouTube videos. It’s sort of their draw to keep you watching video on their site. For the most part the “related videos” are usually somewhat relevant, but in this particular case, they were sooooo not.
My first response to them was that there should be a setting (either client side when you get into the embed options, or in the account section, that they could control globally for all of their videos). After all, I think this is standard in Vimeo from the client embed options. Guess what, it’s not. I did some digging around this morning because this had honestly gotten the better of me because I knew I had done this before. The embed that we started with for the was this piece of code that draws an inline frame, which I’m not a huge fan of in the beginning but it works.
<iframe width=”853″ height=”480″ src=”http://www.youtube.com/embed/0000000000″ frameborder=”0″ allowfullscreen></iframe>
Okay, so basically, we are embedding the video found here: http://www.youtube.com/embed/0000000000 into a page or post as opposed to the old embed method below:
<object width=”853″ height=”480″><param name=”movie” value=”http://www.youtube.com/v/000000000?version=3&hl=en_US”></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com/v/0000000000?version=3&hl=en_US&rel=0″ type=”application/x-shockwave-flash” width=”853″ height=”480″ allowscriptaccess=”always” allowfullscreen=”true”></embed></object>
Cutting to the chase, to hide related videos from any videos on YouTube, you can do so by adding this to the url string:
&rel=0
So, the fix for this particular situation was this:
<object width=”853″ height=”480″><param name=”movie” value=”http://www.youtube.com/v/0000000000?version=3&hl=en_US&rel=0″></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com/v/0000000000?version=3&hl=en_US&rel=0″ type=”application/x-shockwave-flash” width=”853″ height=”480″ allowscriptaccess=”always” allowfullscreen=”true”></embed></object>
By the way, I’ve tested this and it does work. Some of you may have already been aware of it but my brain was rusty this morning. Why YouTube doesn’t allow you to turn this on and off either at the administrator level or at the client embed level is a mystery to me. I guess they get a lot of traffic from related videos…
Joe says
Does that mean that when embedding video in WP I need to use the full embed code instead of the short link (the easy, lazy way I like)?
Cotton Rohrscheib says
Yeah, I couldn’t find a setting to turn that off on YouTube’s side so the only way I guess is to edit the old style embed code.
Cotton Rohrscheib
Partner, Co-Founder – Pleth, LLC
http://www.pleth.com
http://www.cottonrohrscheib.com