Embed video using only the url

given youtube url, how can I embed a video in a page using .net C #?

+8
html c # youtube video
source share
3 answers

In ASP.NET MVC 3, you can use the Video.Flash method from ASP.NET Web Page Helpers :

 @Microsoft.Web.Helpers.Video.Flash("http://www.youtube.com/v/xxxxxx") 

Here is a decent blog post explaining how you could implement it:

Update

If you do not want to use Microsoft web page directories, you can, of course, write your own HtmlHelper extension method. You can find a good downloadable example for HtmlHelper for showing YouTube videos in ASP.NET MVC in this blog post:

+7
source share

Just add a line as shown below.

 <iframe type="text/html" width="640" height="385" src="http://www.youtube.com/embed/[VIDEO_ID]?autoplay=1" frameborder="0"> </iframe> 

With auto play, = is set as you like, either 0 or 1 (depending on whether you want people to actually stay on your page or not :)

+14
source share

You can try with video tag 5:

  <video id="SomeID" name="media" src="http://youtube.com/somevideo" /> 
+4
source share

All Articles