Search settings
Note: some videos not suitable for minors may still appear in search results.

Enhance Your Website with YouTube Video

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. Log 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".

How do I add videos to an eBay auction?

Filming an item to post on eBay is perfect for creating extra interest, especially for more expensive objects where the buyer will want to know more about the item before bidding. Here's how to do it.

  1. Film your item! How you do this is up to you. Then upload the video to your YouTube account in the normal way.
  2. Log in to eBay, press "Sell", and select "Advanced sell".
  3. Choose a category and move on to the "Create your listing" page.
  4. When you get to the "Describe the item you're listing" area, click "HTML" tab.
  5. Go to your video on youtube.com, and copy the embed code from the grey box to the right of the video player. Paste this into the HTML box in the eBay listing. Note you can still add all the text for your eBay posting as normal.
  6. 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.
  7. Complete the posting as usual.


Advanced Embeds and Revenue


How do I display multiple videos in the same embed?

So you're ready for something a bit cooler, eh? How about an automatically-updating video bar that shows the content you've chosen?

The video bar is a little application that can live anywhere on your website, displaying a small selection of videos which automatically update. You can fill your video bar with different feeds—like Most Viewed, Most Rated, and Recently Added videos—or channels or search expressions. When a user clicks on a video in the bar, a window pops up and plays the video. Try out the video bar below from our own YouTube channel. Then make your own with a wizard that will generate all the code for you according to how you want the bar displayed.

Here's a sample video bar:

Loading...

How can I make money with embedded videos?

If you have an AdSense account, you can add Video Units to your site. Video Units are embedded, customizable video players featuring content from categories, individual content providers, or automatic keyword-based targeting. Here's how to set up your player, assuming you've already signed up for AdSense and linked your accounts:

  1. Go to New AdSense Player, fill out the information required, and choose the theme and layout.
  2. Choose the content options. If you choose "Automated Content," Google will fill the player with videos based on the content of your site. You can add keywords to target further.
  3. Click the "Generate Code" button to get your HTML code and save the player.
  4. Copy the code from the "Embed Code" section and paste it into your website or blog where you would like the player to appear.

APIs and User Engagement


Can visitors search YouTube videos from my site?

You can use the YouTube APIs to let users search YouTube directly from your site, pulling up results which can viewed without having to go to YouTube. Using APIs in combination, you can limit searches by category, tag, or user; and control the number of results returned and whether they're ranked by number of views or the relevance. For example, if you have content on your own YouTube channel, you can build an application that allows users to search only through your own videos, and then watch them without leaving your site.

For more information, please go to http://code.google.com/apis/youtube.


We have a site which caters to a community—can we let the community upload, discuss, and share videos?

The YouTube APIs are designed to enable these scenarios. There are two ways you can go about this:

Site-owned videos: Using the YouTube APIs, you can upload all user videos into your YouTube account. In essence, you will own these videos, and your users should be made aware of this. Once the videos are uploaded, you can query and embed them into your site using the YouTube embedded player.

Using the YouTube APIs, you can enable commenting and rating on these videos. Since the comments and ratings will go under your account name on the YouTube site, this implementation makes sense if your community is small and fairly trusted. If that is not the case, you are better off implementing user-owned videos as described below.

User-owned videos: Using the YouTube APIs, you can allow users to upload videos into YouTube from your site. Unlike site-owned videos, the users will own their videos under their individual YouTube accounts. YouTube APIs provide you the ability to embed hidden tags in the video, which allow you to query and restrict the videos to only those that came from your site. If your site hands out its own user accounts, you can implement a one-time association of accounts which should make this process more transparent to your users.

Using the YouTube APIs, you can enable commenting and rating on the videos that came from your site. Since the comments and ratings will go under the end users' YouTube accounts, this solution scales to a larger community.


I work for a large blog/web company. How can video increase user engagement on our site?

Video is much more engaging than text. It draws more users and keeps them on your site for longer. YouTube has a large repository of Internet video content along with the search, playback and API tools to make adding video easier for you.

When looking to increase engagement, try using video as a way to start discussion or make a commentary by creating more context for your users:

Screenshot of Perez Hilton website


We have a site and we have our own videos. Can we post these on our site using YouTube?

It's very easy to build out your own site with your own videos for free. All you need to do is upload the videos to YouTube first. There's no charge and we will cover hosting and streaming costs. It's not only a great way to increase user engagement on your site, but it's very easy, and free as well.

Once you have uploaded the videos you have a few ways of pulling them back to your site:

  1. Embed videos one-by-one: Go to the video that you want to put on your website, and look for the 'Embed' box underneath the video player. Copying the HTML code that's there into your blog will create an embedded player; the video will play within your site when the user clicks on the 'Play' button.

  2. Pull videos back to your site dynamically: Creating a feed of your most recently uploaded videos is quick and easy. You can export feeds of your most recently uploaded videos; your favorites; or playlists. So if you want to be able to choose which videos the feed displays on your site easily, you can just favorite them on your YouTube channel or add them to a playlist. Find out more about this in our Developer's Guide.

    If you have more than one channel you can either set up each feed or have one channel subscribe to the other channels and take a feed from the subscription of the original channel. There is more information in the Developer's Guide.

  3. Search through your videos: You can use the YouTube APIs to let users search YouTube directly from your site, pulling up results which can viewed without having to go to YouTube. Using APIs in combination, you can limit searches by user—i.e., your own uploaded videos—and control the number of results returned and whether they're ranked by number of views or the relevance. For example, if you have content on your own YouTube channel, you can build an application using the code below that allows users to search only through your own videos, and then watch them without leaving your site.

    For more information, please go to the Developer's Guide.