Blue Theme Orange Theme Green Theme Red Theme
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
DevExpress UI Controls
Search :       Advanced Search »
Home » Internet & Web » How to use google ajax search api to embed video searh in web application:

How to use google ajax search api to embed video searh in web application:

Google has launched Ajax API for different purposes “video search” is one of them. Many user's gets confused all about it many times 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.

Page Views : 2307
Downloads : 67
Rating :
 Rate it
Level : Intermediate
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
VideoSearchAPI.zip
 
 
DevExpress Free UI Controls
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 


HTML clipboard

How to embed video searh in web application:

Google has launched Ajax API for different purposes "video search" is one of them.

Many users' gets confused all about it many times 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:

First you have to get the google search API key for this
http://code.google.com/apis/ajaxsearch/signup.html

Visit here and fill the information and then use of gmail account to get the API key
Note: You can get a gmail account free

 The key page will look like this.

 api key.JPG

How to use this code:

Now copy the whole HTML code:

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

"Video Search"

If you listen about 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);

Then the whole code will look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
   
<title>My Google AJAX Search API Application</title>
   
<script
src="http://www.google.com/jsapi?key=ABQIAAAABE_5tJYjIxZez706qj8fKhSHXJsp5oogWH5jZodYSc2VMsh-GBTebFLwydk8evvTefXYLwNiLYMO_A" type="text/javascript"></script>
<script language="Javascript" type="text/javascript">
   
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);

   // Draw the control onto the page

  searchControl.draw(document.getElementById("searchcontrol"));
// Search for a YouTube channel

  searchControl.execute("ytchannel:NBA");

}
google.setOnLoadCallback(OnLoad);

  </script>
</head>
<body>
   
<div id="searchcontrol">Loading...</div>
 
</body>
</
html>

The final output will look like this:

video search.JPG
Formating the Output:

If you want to format the output then you can use the style tag.

Just use this code after closing the </script> tag.

 <style type="text/css">
body
      {

            font-family:Arial Rounded MT Bold;
            background-color:Silver;

      }

#searchcontrol

      {

            background-color:ActiveBorder;
           
width:50%;
            margin-left:auto;
            margin-right:auto;
            text-align:left;
  }
<
style/>

The output will look like this

video search style.JPG

NOTE : In my next upcoming article I'll examplain the whole search techniquies of GOOGLE . 

CONTINUE…

Conclusion
We learned how to get the google Ajax search API key and how to use video search in our web application. 

Nikhil Kumar

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Nikhil Kumar
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the Top 5 .NET Memory Management Fundamentals
To write the best .NET code, you need to know exactly how the .NET framework really manages memory. Ricky Leeks presents the Top 5 fundamental facts of .NET memory management. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
 Comments
Good Work by Manish On August 25, 2010
Nice Article. Keep it up.
Reply | Email | Modify 
Re: Good Work by Nikhil On August 25, 2010
Thank you !
Reply | Email | Modify 

 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.