YouTube™ API for ASP.NET

Introduction

Embedded Video Players, based either on Adobe Flash or Microsoft Silverlight technology, could dramatically improve web page aesthetic appeal and overall user experience. This article demonstrates the coding technique for embedding the popular YouTube Video Player (which is built on the above mentioned Adobe Flash) in ASP.NET web pages via an API written in C# and a Microsoft AJAX extension.

The project contains:

  • The default web page "Default.aspx" with the corresponding code-behind: both to be placed in the Application root directory (ASP.NET 2.0+).

  • Code module "YouTubeScriptGenerator.cs" to be placed in the App_Code directory.

  • AJAX library file (AjaxControlToolkit.dll) to be placed in the Bin directory

Another functional DEMO of the YouTube Player embedded in an ASP.NET web page, containing playlist and a set of navigation controls is available at: www.webinfocentral.com/resources/WebTV.aspx

Background

The Embedded Video Player would be capable of streaming (playing back) the audio/video content, available from the www.youtube.com website.

Note: You do not need to subscribe/logon to the site in order to utilize this feature.

The video item ID is encoded into a query string, looking like a random set of characters, for example: x_4CNvG1Q_M, with corresponding full address string: http://www.youtube.com/watch?v=x_4CNvG1Q_M (in particular sample presumably pointing to the video clip titled: “Anastasia Volochkova dancing to Adiemus by Karl Jenkins).

The easiest way to embed the YouTube Video Player is to go to the www.youtube.com website, select the item of interest, and then copy/paste the corresponding snippet, located in the text box marked “embed”, into your own web page, and Voila! YouTube site provides several customization options regarding the video player size (this includes standard settings specified as: 340x285, 445x364, 500x405, 660x525) and color palette selection.

The ASP.NET YouTube API described in this article provides a much wider set of customization features.

轉至:http://www.dfwlt.com/forum.php?mod=viewthread&tid=382



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章