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.
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
|
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. |
|||
|
|||
2 comments :
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.
how to play local path video in our applications could you please help us to get rid of it
Note: Only a member of this blog may post a comment.