Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Play (Embed) YouTube Videos in Asp.net Application or Website from URL

Nov 19, 2014
Introduction

Here I will explain how to play
YouTube videos in asp.net application or website using c# or Embed or Display YouTube videos in asp.net website from URL.

Description:
  
In previous articles I explained Show
jQuery show YouTube video in modal popup in asp.net website, jQuery add play image icon to youtube videos, jQuery hide youtube video controls , jQuery generate thumbnails for youtube videos and many articles relating to YouTube, asp.net, c#,vb.net and jQuery. Now I will explain how to play YouTube videos in asp.net application or website.

We can embed and play YouTube videos in website from URL in different ways

Method1


<iframe src="http://www.youtube.com/embed/FG0fTKAqZ5g" height="315" width="560" allowfullscreen="" frameborder="0">
</iframe>
 Method2


<embed src="http://www.youtube.com/v/FG0fTKAqZ5g&hl=en_US&fs=1&"
type="application/x-shockwave-flash" allowscriptaccess="always"
allowfullscreen="true" width="640" height="385">
</embed>
To play YouTube videos in website we need to use the url format like as mentioned above methods because while searching for different videos in YouTube we will get different URL formats to avoid that we can use above URL formats just by replacing video url code.

If you want complete example write following code in your aspx page 


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Play Youtube Videos in asp.net website</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<object width="640" height="385">
<b>Method1</b>:
<iframe src="http://www.youtube.com/embed/FG0fTKAqZ5g" height="315" width="560" allowfullscreen="" frameborder="0">
</iframe><br />
<b>Method2</b>:
<embed src="http://www.youtube.com/v/FG0fTKAqZ5g&hl=en_US&fs=1&"
type="application/x-shockwave-flash"
allowscriptaccess="always"
allowfullscreen="true"
width="640"
height="385">
</embed>
</object>
</div>
</form>
</body>
</html>
When we run above code we will get output like as shown below

Demo

Sample1:

Sample2:


If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

1 comments :

NOORULLA KHAN said...

Dear sir I have a major problem in my project, How to play a youtube videos from database based on stored youtube video link saved in the database in asp.net vb.net? Please help me out in this problem. I have made a search on Google. But no luck since two weeks. So finally I have decided to post my problem on this forum. So I request sir please help me out.

Give your Valuable Comments

Other Related Posts

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.