Embeddable Widescreen YouTube Player

UPDATE: YouTube has now officially released their new widescreen player, and the method I describe in the original post is obsolete, albeit still functional.

However, the embed code that YouTube provides doesn’t actually account for the fact that your video is widescreen. In other words, unless you change the height of the player that you embed in your website/blog, you will still get the black bars at the top and bottom of your video.

To fix this, you will need to change the height of your video in both the embed and object tags. While the dimensions of your video may vary, I’ve found that a 260 pixel height is the magic number for a standard widescreen video.

You can also embed higher quality videos by adding either “&fmt=18″ (for good quality) or “&fmt=22″ (for HD quality) to the end of the URL.

For example:
<object width="425" height="290"><param name="movie" value="http://www.youtube.com/v/P3PDLsJQcGI&hl=en&fs=1&fmt=22"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/P3PDLsJQcGI&hl=en&fs=1&fmt=22" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="290"></embed></object>

Of course, when you embed the higher quality videos, you can make the player you embed larger without artifacting. Be warned, however, that the HD quality videos don’t necessarily download very quickly. Your viewers may get frustrated while waiting for YouTube to buffer the video.

Screenshot of YouTube Widescreen PlayerYou may have noticed a link reading “Try the New YouTube Player Beta!” under videos on YouTube. The new player is pretty sharp looking. Moreover, it has a sweet widescreen version. Unfortunately, YouTube provides no instructions on embedding the new player on your blog/website. I searched Google and didn’t find any instructions anywhere, so after I figured it out, I thought I should share with the world.

To embed a regular 4:3 video, use the following code.
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/swf/watch.swf?video_id=YOUR-VIDEO-ID-HERE"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/swf/watch.swf?video_id=YOUR-VIDEO-ID-HERE" type="application/x-shockwave-flash" wmode="transparent" width="480" height="385"></embed></object>

There is one caveat when using the new player: the videos start automatically whether you want them to or not. I’m sure this is something YouTube will deal with once the player comes out of beta, but for now, we’re stuck with it how it is. At least, I think so. I couldn’t find any way to stop it, although I didn’t try using the API. If you know how to stop it from auto-playing, let me know in the comments.

To embed a widescreen video you must add &vq=2&fmt_map=6/720000/7/0/0 to the end of the URL (shown in the following code box). However, there is an additional caveat when using the widescreen player. Most videos, even widescreen videos, will not work with it. If you get a message saying, “This video is no longer available,” and you’re sure you copied the code correctly, it means that the video will not work with the widescreen player. If you’re having trouble, you can test your code with the video id X13o3efXTmk , which is the video I have embedded below. If it still doesn’t work, your code may be slightly off. Unfortunately, it’s very finicky and breaks at the drop of a hat.

I can’t promise this is repeatable, but I did upload one video that worked with the widescreen player. It had a 1.8:1 ratio (864×480) letterboxed into a 640×480 Quicktime video. I’m sure other ratios/sizes would work as well. The video below has an even wider radio, but 1.8:1 and 640×480 worked for me.

<object width="480" height="295"><param name="movie" value="http://www.youtube.com/swf/watch.swf?video_id=YOUR-VIDEO-ID-HERE&vq=2&fmt_map=6/720000/7/0/0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/swf/watch.swf?video_id=YOUR-VIDEO-ID-HERE&vq=2&fmt_map=6/720000/7/0/0" type="application/x-shockwave-flash" wmode="transparent" width="480" height="295"></embed></object>

Related posts:

  1. Richard Simmons on Capitol Hill
  2. Sports and Student Loans
  3. Robots Attack!
  4. The Higher Education Opportunity Act is Coming!
  5. Hillary Clinton Moves to Suspend the Rules and Nominate Barack Obama
Posted at 2:37 AM on November 26th, 2008
  • http://www.stuffwelike.com David Rodriguez

    Nice job figuring this out!

  • http://justinhamilton.org Justin Hamilton

    now they just need to improve the quality

  • Will Johnston

    While I suppose the quality could be better still, if you set your profile to always play in high quality (or just click the link below the videos that have a link to a high quality version, it’s actually not too bad. This only works for new content that was uploaded at a higher resolution though.

  • http://www.americaneducated.org sEPH

    coolness. thanks.

  • Pingback: YouTube e Alta Qualità: Come Inserire nel Tuo Sito i Video in Qualità Migliorata

  • http://danielmcormond.com/ Daniel

    A similar guide based on YouTube’s recent changes is available here:

    http://danielmcormond.com/2008/11/25/how-to-embed-widescreen-youtube-video/

  • http://mackney.com Richard Mackney

    I have hacked about with the code and have been able to get my video test to load widescreen without adding anything extra after the URL and found that adding &autoplay=0 stopped the autoplay but looks wrong as the static start image is still 4:3

    I guess they are still making changes to the player as we speak.

    Here is a link to my experiment if you are interested: http://mackney.com/blog/2008/11/embeding-youtube-widescreen.html

    Cheers, and thanks
    @mackney

  • Jen

    Thanks Will. I’m using your hack successfully but I’d like to also switch off related videos. &rel=0 doesn’t seem to work at the end of the string, after the id, or anywhere else for that matter? Any suggestions?

  • http://www.bipolaradvantage.com Tom Wootton

    This method works best of all the ones I have found. I can’t find any reference for the calls and what the options are though.

    vq=2 – what is vq? what are the options?

    &fmt_map=6/720000/7/0/0 – there are many references to fmt suggesting 18, 22, etc. , but never fmt_map – what is that? What are the options? This option makes for slow downloads, but the quality as fabulous!

    All other params seem to work along with it too like color1 and color2, etc.

    Thanks for your great work helping the community.

  • Pingback: Embed widescreen youtube videos « Humar’s Cradle

  • Will Johnston

    Hey Jen, not sure what to do about that one. The only thing I can think is to make sure you put them in both the embed and object tags. Sorry, I know that’s simplistic, and I’m guessing you’ve already tried, but that’s all I’ve got.

    Tom, sorry, not sure about fmt_map either :(

  • http://thecorrectcodeis... george

    instead of using:

    &vq=2&fmt_map=6/720000/7/0/0

    you must use:

    &hl=en&rel=0&ap=%2526fmt%3D18

    Guarantee this will work instead!!

  • mhmu

    hi

    this code :
    &hl=en&rel=0&ap=%2526fmt%3D18

    is not work !!

    how remove any related video ?

  • http://willfjohnston.com Will Johnston

    Hey mhmu, I’m not sure how to remove the related videos. I don’t know if that’s the code you’re using, but it looks like you’ve got some extra characters in there. You want &fmt=18 – not the hex values.

  • Pingback: Beginner’s misfortune with home video « Virgo’s Naive Stories

  • http://www.jameslclark.com James

    Thanks, great stuff. Needed information on this!

More in Tech
Need Any Design Work Done?

If you need some design work done, drop me an e-mail. I haven't put together an updated portfolio, but here...

Close