Monday, August 31, 2009

YouTube on Your Site

YouTube on Your Site

Whatever presence you have on the Internet—a large website, a blog, a social network page, or pretty much anything else—there are many ways to integrate YouTube into it. From simple video embeds to our full-powered APIs, you can integrate video at all levels of technical expertise.
Bringing YouTube to your site is more than just adding some of the millions of videos available on YouTube. It keeps your visitors interested and allows self-expression and interaction with one of their favorite services. And it brings your site, blog, or page into the YouTube video community—an international network of users, creators, and sites connected through the Web's largest collection of online videos.
We've highlighted some typical ways of integrating video content below—just click the arrow next to the question to get the answer. If you have any questions or suggestions, or projects that you would like us to know about, please leave a post at the Developer Forum.

The Basics

How do I add a video to my blog or web page?

  1. You'll need to edit the HTML of your blog entry or page—this should be relatively straightforward. In Blogger, for example, just click the "Edit HTML" tab.
  2. Next, go to the video that you want, and look for the 'Embed' box in the "About This Video" section. Copying the HTML code that's there into your website will create an embedded player; the video will play within your site when the user clicks on the 'Play' button.
  3. You can resize the player by editing the object width="425" and height="350" fields at both the beginning and end of the embedded player code. Make sure that the sizes you choose have the same ratio as the default numbers, so that the video doesn't get stretched—just multiply the width by 0.8235 to get the height.

How do I add a playlist to my blog or web page?

To show a selection of videos that is easily editable, embed a playlist. When you update the playlist on YouTube, the playlist on your site will update as well. This is a good way of creating longer stories through a series of videos, or simply giving your readers more pre-selected content to watch.
  1. To create a playlist, go to the My Playlists page, click 'Create a Playlist' and fill out the information.
  2. As you find videos you like on YouTube, click 'Add to Playlist' under the player to add them to your list. You can change the order of the videos in your playlist by returning to the 'My Playlist' page.
  3. The easiest way to embed a playlist is to create a custom player. Go to your YouTube account and click "Custom Video Players", then "Create Custom Player". Select a color and format for your player, and then choose what is going to play in it—you can choose a playlist, your own uploaded content, or your favorites—and then click the "Generate Code" button.
  4. Copy and paste the code into your blog entry or web page, just as you did with the embedded video above.

How do I add a video to my social network page?

Adding videos to your profiles on social networks like MySpace and Facebook is a great way to share your videos or favorites with friends. Or, if you're promoting something (like your band) on MySpace, videos will help attract visitors to your page, who can then then share the link with their friends. The social network sites have similar ways to add videos, so we'll use MySpace as an example.
  1. Sign in to your MySpace profile, then click the "Edit Profile" button.
  2. Next, go to the video that you want, and look for the 'Embed' box in the "About This Video" section. Copying the HTML code that's there into your website will create an embedded player.
  3. You can resize the player by editing the object width="425" and height="350" fields at both the beginning and end of the embedded player code. Make sure that the sizes you choose have the same ratio as the default numbers, so that the video doesn't get stretched—just multiply the width by 0.8235 to get the height.
  4. Click "Preview", and then "Submit".