raklos
raklos

Reputation: 28555

embed video using just url

given a youtube url, how can i embed the video into a page using .net c#?

Upvotes: 8

Views: 22548

Answers (3)

MemeDeveloper
MemeDeveloper

Reputation: 6792

Simply add in a line like the following

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

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

Upvotes: 14

Martin Buberl
Martin Buberl

Reputation: 47164

In ASP.NET MVC 3 you could use the Video.Flash method from the ASP.NET Web Pages Helpers:

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

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

Update

If you don't want to use Microsoft's Web Pages Helpers you can of course write your own HtmlHelper extension method. You can find a good downloadable example for a HtmlHelper to display YouTube videos in ASP.NET MVC in this blog post:

Upvotes: 7

Hector Correa
Hector Correa

Reputation: 26690

You can try with HTML 5's video tag:

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

Upvotes: 5

Related Questions