Arrowat: Facebook: Youtube: Twitter: Instagram: LinkedIn:

YouTubeTv OpenSource Library For C# Net and VB.Net

On This Page

YouTubeTv library allows you to manipulate a Youtube URL, extracts the Video id and the default image from video , and the video URL ready to play in iframe

Note: It does not use any API or third party library this is an opensource library you can download it from Github at

Youtubetv Works on C# and VB.Net and can be used on ASP.Net web applications and Windows Applications, There are samples added with downloaded source code.

See a Sample

YouTubeTv library How to:

This is a Class library, you can start adding reference to your project or if you don't have it separated as a DLL you can copy all project code contained on the project available from Github Site at : Please check the code sample, I have added a Project test Named 'YouTubeTvtest' that you can guide how to code your own.
If you decide to create your own project you will need to add reference to YoutubeTv.dll that contains the source code compiled on a single file.


You can explore all code from theYouTube library, Let's start checking the library functions and properties

Dowload YouTubeTv from Github

DectectURL Class Members


This function helps you to check if the YouTube URL is Valid , Returns True if the URL is valid and False if the URL is Invalid


This Function helps you to detect a URL between text, it takes the first URL out from any text, you must pass a string text as a parameter value
string FindLinksInText
Exceptions : Invalid URI ,is not a Youtube URL


YouTubeTv.DetectURL detectURL = new YouTubeTv.DetectURL();
if (detectURL.IsValidURL(detectURL.DetectURLLInk(this.VideoLinktxt.Text)) == true)
//Code to excute


YouTube Class Members


Returns the Youtube video URL ready to play.


Returns the Id of the Youtube video.


Returns the Youtube video image URL.


Returns the Youtube video URL provided.


Returns the Width of the video Frame ,the default is '560px'


Returns the Height of the video Frame ,the default is '315px'


YouTubeTv.DetectURL detectURL = new YouTubeTv.DetectURL();
if (detectURL.IsValidURL(detectURL.DetectURLLInk(this.VideoLinktxt.Text)) == true)
YouTubeTv.YouTube TV = new YouTubeTv.YouTube(this.VideoLinktxt.Text);

//message to the user


Here is a complete sample code you can use this sample is added with the downloaded project.
videolinkfromtext.cs code


The HTML code
videolinkfromtext.aspx code


PLayList Class

The playList class allows you to create a list of video you want , for example, You want to create a 10 videos and load to the web page, it makes easy just adding the Youtube video Url and it will be populated the image of the video and it will handle the click event of each button , and it will be ready to play, it is already created for you!, another feature added is that you can add description that you want and it will be added at the bottom of each video, but you can style it as you want by adding a CSS class.
PlayList class require that you create a collection of CreatePlayList PlayList exposes the following member


The Load Function require the following parameters


This container must be an ASP Panel where the Video Images will be added


This container must be HtmlFrame web control with the attribute runat='server' this control will show the video when the user clicks the video image


This is a collection required with List< CreatePlayList > PlayList

CreatePlayList Class Members


Description of the video 'normal it appear at the bottom of the image but you can style it with 'DescriptionCSS' property


'CSS Class' style the description object example: All CSS styles like 'color,font-size etc. you must create a CSS Class'


'CSS Class' style the Image object example: All CSS styles like 'color,font-size etc. you must create a CSS Class'


Set or get the video url of the play list



After you have been filled all properties shown in the image you will need create an instance of PlayList Class


Here is a complete sample code you can use, this sample is added with the downloaded project.
playlist.cs code


The HTML code
playlist.aspx code


YouTubeTv For Windows Application

For windows Application you will need Add reference to "Shockwave Flash Object"
If you don't know how to add reference to this Component please Refer to this tutorial Flash Player Object en C# after you have added reference to "Shockwave Flash Object" you will find easy to work with it. The samples contains all code developed Ready to use.

The following image is from the Windows application, there are some different controls that is used to web application , but we have the power of the Library that does all we need.
The controls that are on this Windows form are:

  • Shockwave Flash Object
  • flowLayoutPanel
  • PictureBox

The picturebox are the video images you see on the Windows Form that are created at Run-Time and added to the flowLayoutPanel.


C# Code sample


VB.Net Code sample


Arrowat MSDN Bing Github Twitter Facebook Linkedin

© 2023 Melvin Dev™