BuzzBadge: How to: Add Google Video Bar to Blogger Beta

Tuesday, October 17, 2006

How to: Add Google Video Bar to Blogger Beta

Following the promise on a BuzzBadge given to Google Video Bar, Here is the full guide on how to insert a Google Video Bar into your Blogger Beta blog (thanks to GSVideoBar Solution). First of all, I must declare that I am not a programmer nor a coder. I am just an average blogger who knows a bit of code here and there. So, I am not going to explain in detail how each element or piece of code work (I don't understand them) and I assume that you know a little bit of HTML and CSS.

Before I start, here are the references that might help you clear some doubts. I managed to insert the Google Video Bar into this blog by putting their codes together:

  1. Google Video Bar Sample
  2. Google Video Search Solution
  3. Google Ajax Search API
  4. Video Bar on Google API Blog
Seriously, if you are a coder, you don't need this newbie guide (and please don't laugh at my code-ignorance). If you are NOT a coder, do not read the references above yet, you will get scared (what happened to me).

Add Google Video Bar to Blogger Beta

Step 1: Get your API key ready
API is not scary. You don't need to understand what's an API key to make this work. I don't. But you need to have your very own API key. Ok, the Video Bar will fetch videos to your blog and display them as a list of thumbnails. In order for it to search and fetch the videos, you have to give it a key to enter the database (am I right?). Go here to signup for your API key. It is easy.

Step 2: Create a Widget to hold Javascript
This is easy too. Go to Template >> Edit HTML, scroll down to almost the end, find
<div id='header-wrapper'>
<b:section class='header' id='header' maxwidgets='1'>

Change maxwidgets='1' to maxwidgets='2'.

This will allow you to create a page element which you can then add a javascript element to hold the script.

Step 3: Load API key and Search Solution
This step is straight forward. Go to Template>> Page Elements, you will now see a new place to add page element, that's in your header. Click 'Add a Page Element', select 'HTML/JavaScript'. In the popup box, leave title to be blank, copy and paste this into the content:

<script src="" type="text/javascript"></script>
<link href="" rel="stylesheet" type="text/css"/>
<script src="" type="text/javascript"></script>
<link href="" rel="stylesheet" type="text/css"/>

<script type="text/javascript">
function OnLoad() {
var vbr;
var options = {
largeResultSet : true
vbr = new GSvideoBar(
vbr.execute("VW GTI");

See that vbr.execute? Replace "VW GTI" with the tag of the videos you want.

Replace 'YOUR-KEY' in the codes above with the Google Search API you just signed up for. Save the Page Element.

Step 4: Insert the CSS
Insert this into your CSS section:

#videoBar {
width : 160px;
margin-right: 5px;
margin-left: 5px;
padding-top : 4px;
padding-right : 4px;
padding-left : 4px;
padding-bottom : 0px;
float: left;

You may do some styling if you know CSS.

Step 5: Show me the Video!
Go to Template >> Edit HTML, change <body> to <body onload="OnLoad()">

Then, below the widget code you entered just now, insert these lines:

<div id="videoBar">Loading...</div>
<div id="videoPlayer">Loading...</div>

This will tell the video bar and video player to load. Don't worry about video bar's position, you can adjust it in the CSS you entered just now. However, you may want to change where the player will load. Move the div with videoPlayer id to any place in your template you want the player to show.

That's it! Hope it works for you!

technorati tags: tags:
icerocket tags:

1 Buzzes:

Hayden Tennent said...

I have found an even easier way to embed a Google Video Bar for showing YouTube videos.

I have written about how to set it up at