This post actually began as an e-mail to a client, who was curious about the best way to embed a YouTube clip in a website. I whipped up some examples, and I thought I'd share.
A lot of people — bloggers, developers, videographers — say they don't like using YouTube to host videos, because they feel "the videos don't look good." But what many don't realize is that you can change quite a bit about how a YouTube clip appears on a blog, site or Facebook tab simply by tweaking some code.
YouTube offers a whole host of "parameters" that you can change in the coding of your embedded video clip. Some are subtle. Some are dramatic. But each can be a huge help in the right situation.
Changing these parameters lets you:
• Remove the "related videos" display, which can often be awkward and very unrelated.
• Prevent the title of the video from appearing on the clip (cleaning up the appearance a bit)
• Force the video to play in high definition on any browser instead of defaulting to a lower quality.
• Get rid of YouTube's player contols altogether, making your clip minimalst in the extreme.
Best of all, even a coding-ignorant rhubarb farmer like myself can use these parameters. Just copy and paste YouTube's embed code from a video page, drop it into your site or blog, and add the parameters onto the video link in the HTML.
Example: I want to post this clip on my blog. When I'm watching the video on YouTube, I click "Embed" just below the player. I use the "Custom" size option and tell it my blog is 460 pixels wide. YouTube does the math for me (huzzah!) and creates a code that looks like this:
<iframe title="YouTube video player" width="460" height="289" src="http://www.youtube.com/embed/fxs970FMYIo" frameborder="0" allowfullscreen></iframe>
Standard YouTube embedded clip:
Looks OK. But I don't want the video title cluttering up my embedded clip. And I don't want to risk the "unrelated videos" being skeevy. So I'll turn off both.
I just find the video link in the HTML code and add a ? symbol, followed by the codes I want to use from YouTube's list of parameters, in this case "HD", "rel" (related videos) and "showinfo". Just use a semicolon (with no spaces) to separate them.
So the code becomes:
<span style="background-color: #fdeee0;"><iframe width="460" title="YouTube video player" src="http://www.youtube.com/embed/fxs970FMYIo?HD=1;rel=0;showinfo=0" height="289" frameborder="0"></iframe>
And the result:
YouTube clip set to show HD, with no title and no related videos:
Still not minimalist enough for you? No worries. You can pull out the nuclear option.
"Controls" is a parameter that lets you turn off the YouTube control bar at the bottom of each clip, replacing it with ... well, nothing. You can play or pause the clip by clicking on it, but that's it.
For this option, the code becomes:
<span style="background-color: #fdeee0;"><iframe width="460" title="YouTube video player" src="http://www.youtube.com/embed/fxs970FMYIo?HD=1;rel=0;showinfo=0;controls=0" height="289" frameborder="0"></iframe>
What you get: A maximum canvas, with minimal clutter.
Obviously, you pay a cost for using this approach. Namely, you lose the ability to rewind, fast-forward or click through to watch the video on YouTube. But hey, beauty has its price.
I'm not saying any one of these three options is best. In fact, there are dozens of options to play with. But hopefully these examples help you see the flexibility of YouTube and how you can occasionally bend the world's largest video service to your whims.