Sunday, March 13, 2011

How To: Silverlight application for searching and playing YouTube videos

Recently I have created an application to search and view the YouTube videos in silverlight.  For

this we need to get the key to access the YouTube APIs. If you have Google email address you can

get the key from here.

http://code.google.com/apis/youtube/dashboard/

Here you have to enter the name, description and website to host the application. Once you get

the key you add to the web.config file.

Once you have the key to YouTube APIs you will be able to make calls to the YouTube API service.

You can find the .NET library for the Google Data API here

http://code.google.com/p/google-gdata/downloads/list

Before getting video information's from YouTube we need do the authentication by calling the

function YouTubeRequestSettings with the application name, key, user name and password.

In this post am searching the YouTube based on keywords entered in the search textbox. You guys can do further research over here.

http://code.google.com/apis/youtube/overview.html

For playing the YouTube video we are using the web browser control in silverlight 4.0. But the limitation for web browser is it will work only in out of browser mode.  I have set the application to run in out of browser mode.  To run the application in out of browser mode we need to change the setting in project solution properties. Under the Silverlight tab, check “Enable running application out of the browser” and click the “Out-of-Browser settings" button as circled below in the screenshot.

image_thumb_3C972566

You can find the source code here

Thanks guys!!!

0 comments:

Post a Comment