How to Embed Video Search in Web Application

Introduction

Google has launched Ajax API for different purposes - "video search" is one of them. Many users' get all confused about it many times regarding how to get Google key, how to embed video search in web application. So here I am explaining how to use video search in web application.

Getting Google Search API Key

Visit the above link and fill the information and then use your Gmail account to get the API key.

Note: You can get a gmail account for free.

The key page will look like this:

How to Use this Code

Now copy the whole HTML code:

This is the code for "WebSearch", Video Search and Blog Search but you have to use only the "Video Search".For this, see the next step.

"Video Search"

If you listen to Google Code (presented by Google), you have to take the video search control from there, which is like this...

Just replace the above code with this:

google.load('search', '1');
function OnLoad() {
// create a search control
var searchControl = new google.search.SearchControl();
// So the results are expanded by default
options = new google.search.SearcherOptions();
options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
// Create a video searcher and add it to the control
searchControl.addSearcher(new google.search.VideoSearch(), options);