featured contributor

YouTube embed options Photo: Handicam Credit: Sanja Gjenero

YouTube embed options are a great way to get a more professional look from your embedded videos.  The trick is to understand what codes to use and how to insert them into YouTube’s embed code. YouTube doesn’t make it so simple to do, though.  This is a short tutorial to go over some of my favorite options to personalize your embedded video.

This post was inspired in part by Ellen Bremen’s wonderful video post yesterday (if you haven’t seen it you need to check it out).  My intention was to make the video play automatically, to take away all of the visible bars and controls, and to hide suggested videos after the video completes.  So here’s how I went about it:

YouTube embed options: how to find the basic embed code

Once you have a video hosted on YouTube that you want to embed on your site, you simply have to push “share” and “embed” to get the basic embed code (see the arrow in the illustration).

YouTube Embed Options

YouTube embed options: How to customize your embedded video

The key to this is to understand where to input the additional code and what your options are.  YouTube gives you a rundown of all of your options on their developer site. I’ll discuss a few popular ones at the beginning of the post and later will go through the litany of YouTube embed options with visual examples for each.

The “autoplay” function allows for a video to immediately start when a page loads.  (the value “1″ enables this).  To insert this into the embed code, you would simply use the “?” character and then “autoplay=1″

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/usi8OvRSGs0?autoplay=1” frameborder=”0″ allowfullscreen>iframe>

The “controls” function allows you to hide or show the video controls.  To hide the controls, I insert the character “&” and then “controls=0″ immediately after the last code entered.

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/usi8OvRSGs0?autoplay=1&controls=0” frameborder=”0″ allowfullscreen>iframe>

The “showinfo” code shows and hides the YouTube header bar.  To hide the info bar, I insert the character “&” and “showinfo=0″

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/usi8OvRSGs0?autoplay=1&controls=0&showinfo=0” frameborder=”0″ allowfullscreen>iframe>

Finally, in order to remove related videos from the end of the video I insert “&” then “rel=0″ like this:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/usi8OvRSGs0?autoplay=1&controls=0&showinfo=0&rel=0” frameborder=”0″ allowfullscreen>iframe>

What does each YouTube embed parameter look like?

To take this post a step further, I thought it might be helpful to go through each of the embed options and visually show what each addition would do. For your reference, you can find a definitive list of parameters that you can control for an embedded  YouTube video: https://developers.google.com/youtube/player_parameters?csw=1. It’s important to note that there are settings specific to Flash players (you can get these embed codes by checking the box for “get old embed code” when getting the embed code for any specific YouTube video), and HTML5. For the purposes of this post, all embed codes are HTML5 compliant (mobile devices won’t display Flash making HTML5 a better solution for most purposes).

So I’m going to use the Rick Astley “Never Gonna Give You Up” video (aka the “Rick Roll”) as our example video. So, here is the default embed from YouTube:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0″ frameborder=”0″ allowfullscreen>


Autohide

Now we’ll add “autohide.” Autohide has three values, “2″ which is the default and video progress bar to fade out while the player controls remain visible, “1″ which hides the progress bar and player controls after a few seconds, and “0″ which will keep the progress bar and player controls visible always. In this embed, the autohide value is set to “1.” The difference may or may not be especially distinguishable.

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?autohide=1″ frameborder=”0″ allowfullscreen>iframe>


Autoplay

I discuss autoplay above and for the sake of your sanity I have omitted an example of this. Trust me, it works.

cc_load_policy

This allows you to turn closed captions on, even if the user has them turned off by default. The “0″ value turns closed-captions off, and the “1″ value turns closed-captions on. (For this example we’ll use a different video since Rick Astley’s video is disappointingly not closed captioned)

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/g5t1r7yG7rM?cc_load_policy=1″ frameborder=”0″ allowfullscreen>iframe>


color

The color parameter dictates the color that the progress bar shows on the video. There are two parameters to choose from: “red” and “white.” Red is the default, so here is an example of the “white” parameter:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?color=white” frameborder=”0″ allowfullscreen>


controls

The controls parameter determines when the controls will display. The “0″ setting will prevent controls from showing, the “1″ setting is the default and shows controls, and the “2″ setting is the same as “1″ except that Flash isn’t loaded until the player plays. Here is an example of the “0″ setting:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?controls=0″ frameborder=”0″ allowfullscreen>iframe>


disablekb

The disablekb parameter will disable the keyboard controls. This parameter value is “0″ by default, but can be changed to “1″ to disable the keyboard controls.

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?disablekb=1″ frameborder=”0″ allowfullscreen>

I haven’t included an embed option as it doesn’t do anything visually to the video. Incidentally, YouTube keyboard controls are as follows:

Spacebar:  Play / Pause
Arrow Left:  Jump back 10% in the current video
Arrow Right:  Jump ahead 10% in the current video
Arrow Up:  Volume up
Arrow Down:  Volume Down

enablejsapi

The enablejsapi allows you to enable the Javascript API to control the YouTube player. If you need this parameter (which is “1″ to enable and “0″ by default incidentally), stop reading this post – you probably don’t need it. :)

end

The “end” parameter enables you to determine a duration (in seconds) that your video will play and then conclude. Note that the time is from the beginning of the video and not from the complementary “start” parameter that I’ll discuss in a moment. Note that YouTube says this doesn’t work for HTML5, but it appears to be working in this two-second example:

<iframe src=”http://www.youtube.com/embed/oHg5SJYRHA0?end=2” height=”480″ width=”640″ allowfullscreen=”" frameborder=”0″></iframe>


fs

The fs (fullscreen) parameter is another embed parameter that doesn’t work with HTML5. It allows you to hide the fullscreen button. It is set to “1″ (display) by default, but can be set to “0.”

iv_load_policy

The parameter “iv_load_policy” determines whether or not video annotations will be shown. There are two values: “1″ and “3,” where “1″ (the default setting) shows video annotations and “3″ does not. Fortunately, the Astley video has some annotations so you can see the difference between the two. Here is an example where video annotations aren’t shown:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?iv_load_policy=3” frameborder=”0″ allowfullscreen></iframe>


list and listType

List and listType are Flash-specific commands to determine and control a video playlist. Because the “playlist” command works for HTML5 as well, it’s probably a better tactic to use that parameter to create a playlist so I’ll skip over these.

loop

This setting allows you to set your video to repeat ad infinitum. The “0″ value is the default (stop at the end) value, and the “1″ value will create a loop. For giggles, I’ll embed the Astley video with loop enabled (though I hope nobody will need to watch it a bunch to find it helpful :) ). You’ll note in the code that in order to make “loop” work it should be used in conjunction with the “playlist” attribute.

<iframe width=”640″ height=”480″ src=”//www.youtube.com/embed/oHg5SJYRHA0?loop=1&playlist=oHg5SJYRHA0” frameborder=”0″ allowfullscreen></iframe>


modestbranding

The modestbranding setting allows you to show your videos without the YouTube logo showing. You’ll notice that the YouTube logo goes away but it’s not as incognito as you might imagine. In any event, the value to turn on “modest branding” is “1.”

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?modestbranding=1” frameborder=”0″ allowfullscreen></iframe>


origin and playerapiid

These two functions are used in conjunction with the Javascript enable. Since I don’t know too much about this aspect of YouTube embeds I’ll skip these for now.

playlist

The playlist function allows you to play a prescribed list of sequential YouTube videos in your embed. It’s pretty simple to use, after the playlist command you list the IDs of the videos that comprise your list each separated by a comma (note that if you mention the first embedded video in the list it will play twice). This is a video list of Rick Astley videos – if you watch carefully you may come to the same conclusion that I have that he was Robin Thicke before Robin Thicke was Robin Thicke…. but I suppose that’s an ad sequitur to the embed option post:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?playlist=0oicc86PwEM,lq2zHpcLBXI,MkYGDzO_2hs,WepArag_IUc” height=”480″ width=”640″ allowfullscreen=”" frameborder=”0″>


rel

The “rel” parameter determines whether you want to show related videos at the end of your video or playlist. The default is “1″ for yes, and conversely the value of “0″ will prevent related videos from being shown at the end of the embedded video. Here is an example:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?rel=0” frameborder=”0″ allowfullscreen></iframe>


showinfo

The showinfo parameter determines whether the video information is presented before the video is played. The “1″ value is default, and “0″ value hides the video information as such:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?showinfo=0” frameborder=”0″ allowfullscreen></iframe>


start

The start parameter determines the spot where the video will begin playing (measured in seconds from the beginning of the video). Recall that this can be used in concert with the “end” function, but both parameters are measured in seconds from the beginning of the video. Here is an embed of the Rock Astley video where a bartender does a backflip (102 seconds in):

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?start=102” frameborder=”0″ allowfullscreen></iframe>


theme

The theme parameter allows you to choose either a dark or light theme for your embedded video player. The “dark” value is default, and here is an example of the “light” value:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?theme=light” frameborder=”0″ allowfullscreen></iframe>


Putting it all together

So, I thought it might make sense to put some of these parameters together to show how they work in concert. In this example I hid the video information, hid the notes throughout the video and hid the video controls. Note that these parameters don’t work well with the modestbranding parameter so I couldn’t include it. The result is a very clean looking embed and optimal viewing experience for fans of Rick Astley:

<iframe width=”640″ height=”480″ src=”http://www.youtube.com/embed/oHg5SJYRHA0?showinfo=0&iv_load_policy=3&controls=0” frameborder=”0″ allowfullscreen></iframe>


If you have anything to add, please feel welcome leave a comment. And if this was of use to you, please take a moment to share this with others on your social networks. Happy embedding!

Jim Dougherty

Jim Dougherty

Writer and chief of miscellany at leaderswest.com
I aspire to give people something to think about rather than tell them what to do. My favorite Google Alert is "social media research," I am increasingly compelled by Gen Z, and I appreciate good writers agnostic of where they write. At one time I was Kred's 12th most influential social media blogger and Klout's most influential person on the topic of David Hasselhoff. Transplant from Seattle living in Cincinnati. Haven't entirely adopted the local sports teams yet.
Jim Dougherty
Jim Dougherty
Jim Dougherty
  • Ben Baker

    Jim, great helpful information, thanks. Ben

  • http://www.wonderoftech.com Carolyn Nicander Mohr

    This is great information, Jim. I have to say though that I really, really don’t like it when I open a page and a video starts to play. I like very much being able to delete the related videos at the end of a YouTube video!

  • jimdougherty

    Thanks Ben and appreciate you sharing this on LinkedIn as well! Cheers!

  • jimdougherty

    Thanks Carolyn! I understand how that can be off-putting, but the rationale for autoplay (in my mind) is to give a message or a snippet of a message before a person can arbitrarily opt out. I think that’s a powerful and useful tool to give content the highest likelihood of being noticed. Thanks so much for reading and commenting!

  • http://twitter.com/talknologyfm Talknology

    so THAT’S how they do it! Great share, Jim.

  • http://twitter.com/Mompreneurmogul Lisa Cash Hanson

    Right selfish or not I”m glad you did LOL I need to book mark how do they add that white play button have you seen that?

  • TheTysonReport

    Very useful Jim, thank you.

  • Tony Restell

    Great post Jim, thanks. I have another one for you to add to the list – having a video start part way through the recording if there’s some content you want to skip or a particular section of the video you want to show…

    I was writing a piece on using Facebook for recruiting and had a great webinar recording to use as part of the post (see: http://www.social-hire.com/social-recruiting-advice/1165/adding-facebook-to-your-social-recruiting-strategy-10-point-checklist) but the problem was that the first 2 minutes of the video came across unprofessional – checking the audio was working etc. and so I wanted to skip that. The code to achieve this is to add to your URL

    &start=108

    where the number equals the number of seconds into the video that you want it to start from.

    Hope this helps someone out there – and will certainly be looking to incorporate your other suggestions Jim. Not showing suggested videos at the end was something I’d already taken care of, but the other whitelabelling suggestions are great, thank you!

  • jimdougherty

    Hi Lisa! I think that you would do everything I did without autofollow. For example:

    $controls=0&showinfo=0

    and that should give you a video screen with just the play button! Thanks for reading and commenting!

  • jimdougherty

    Thank you for reading and commenting!

  • jimdougherty

    Thanks for reading and commenting!

  • http://LisaLadrido.com Lisa Ladrido

    Thank you Jim! WordPress only allows me to add the URL to the video. I haven’t been able to use the html like I was able to with Blogger. Should I be using a specific WP plugin instead so I can edit the html? Thanks for another great post!

  • Samantha Gluck

    Lisa, you can add embed code if you’re self-hosting on a wp platform….

  • jimdougherty

    Hi Lisa, as Samantha said this is for self-hosted (wordpress.org) websites. If you are using wordpress.com, here is a post that describes how to embed youtube videos:

    http://en.support.wordpress.com/videos/youtube/

    It’s been awhile since I used wordpress.com, but it appears from that article that you can accomplish the same things by adding the codes to the end of the video link. I’m curious and happy to help if you ever find yourself wanting to do this. Shoot me a message! Thanks for reading and commenting!

  • http://LisaLadrido.com Lisa Ladrido

    I am on the self hosted WP. For some reason each time I would add the html code the video wouldn’t show up. However, it does when using the URL. Therefore, I am unable to edit the code. I will check it out again the next time I need to use a video on a post. Thanks Jim and Samantha!

  • jimdougherty

    Thanks Lisa! Next time (if you like) I’d be happy to help troubleshoot for my own educational purposes.

  • Ryan

    Cheers Jim, I had been looking for this for a while, especially getting rid of the recommended videos at the end. For some reason I still cant get rid of the black bar at the top of the video. I have put the showinfo=0″ attribute into the code but it hasn’t worked. Any ideas? My site is http://www.commissiononlysalesjobs.co.uk if that helps?

  • http://twitter.com/dave_guzman David Guzman

    Thanks Jim, GREAT article! Thanks for sharing!

  • Beena

    Thanks for help :)

  • jimdougherty

    Of course!

  • jimdougherty

    Appreciate the note, David – Thanks!

  • azatrum

    very very helpful!

    thanks!

  • Christopher Pelton

    Thanks a million for this. It was exactly what I needed.

  • Hussain Badusha

    Very useful notes that you’ve given.
    Thanks very much for providing this…

  • jimdougherty

    Thanks Hussain!

  • Jonathan

    hi, cAN YOU HELP ME WITH THE CODE TO HIDE THE YOUTUBE VIDEO URL FROM MY EMBEDDED VIDEOS ON MY WEBSITE?

  • http://www.josephrodrigues.com/ Joseph Rodrigues

    Awesome, very clear and concise!

  • Shishir Bhilawadikar

    What a superb post. Just loved reading it. Always wondered how to do these customizations. Thanks for posting this Jim.

  • Katya Verman

    Hello! Can you tell how to stop all the suggestions of the different videos which are not related to Company’s videos or how to make the video start from the beginning after ending?

  • jimdougherty

    Hi Katya,

    Sure.For the related posts the command you’re interested to change is “rel” – it can be either “0″ or “1″ and to turn it off, you want it to be “0.” &rel=0
    To repeat your video the command you are looking for is “loop.” It can be a value of “0″ (no repeat) or “1″ (repeat). &loop=1
    Hope that helps!

  • jimdougherty

    Thanks so much Shishir.

  • jimdougherty

    Thanks Joseph!

  • jimdougherty

    I don’t know if that’s possible. Sorry.

  • Keef Hellinger

    very useful thx, do you know how to remove the black border so that it is transparent and blends into my website. I have sized video to full page width via custom size but on a tablet the black border comes straight back? many thx in anticipation keef…. ps theme=light doesn’t work

  • JD

    Great info! FYI, your font size and page width is huge, I am on a 22″ monitor and still had to scroll left and right.

  • jimdougherty

    Appreciate the feedback – the site is supposed to be responsive, so I’ll have to do some more testing. Cheers!

  • jimdougherty

    I’m sorry – I looked into this and it doesn’t look like it’s easily possible in the new player. If YouTube gives you an option to use the old embed code you can use border=”0″ – otherwise I expect there is a solution but it’s beyond my technical aptitude. Sorry!

  • bitkahuna

    auto playing video is a huge no-no. if someone’s in an office cube and a site they go to starts blaring a video that they didn’t ask to play, it’s obnoxious and could even get someone fired. it ‘seems’ like a good or ‘powerful tool’ but it’s irresponsible and obnoxious. just sayin’
    on a more positive note, your summation of youtube options is really helpful, thank you!

  • jimdougherty

    Thanks for your comment. I don’t mean to sound like I disagree with your premise, but I will say that despite the general apprehensiveness towards autoplay video it has been studied and found quite effective. An analog might be ads in gmail – people by and large don’t want them but many click-through regardless.

    Not that it makes autoplay videos any less annoying to the user, but saying that they’re a “np-no” is not accurate from a marketing perspective. They’re actually quite effective.

  • James

    Thanks for the tips. Have you been able to successfully embed a youtube playlist, with the thumbnails/sidebar to show up on the right hand side of player? Just like when you visit your own youtube page. I can embed the player along with the playlist, but users must click on the top left of the video. Some older folks may struggle with this. Thanks!

  • jimdougherty

    Hi James – I don’t have any experience with playlists myself and I tried to take a look and see if I could offer an idea of how to handle your situation and it’s beyond me. Sorry!

  • Mark F Simmons

    Thanks for this!

  • Stephanie Deneke

    NICE! I’m making a capture page tonight and I just googled how to do the autoplay and your post showed up on page 1…. finding the other codes was a bonus so I bookmarked this on my browser :) I’m still trying to figure out how to hide the YouTube watermark in the lower right corner that says “watch on youtube” when you hover over it. If anyone knows how to do that it would be awesome to know.

  • jimdougherty

    Thanks Stephanie – your comment made me redo the entire most with more detail. I’m not sure that there is anyway to get rid of the watermark appropriately, but I hope the examples give you a visual of what each parameter can do. Very helpful comment – thank you!

  • http://www.reformationdesigns.com/ Ryan J. Rhoades

    This is fantastic, Jim – thanks so much!

  • Carlos Davis

    Excelent! great helpful information, thanks. Regards

  • Stekker

    Thanks a lot for this post! Very useful!

  • Naveen

    Great very helpful… Thanks a lot