如何在网站上显示YouTube视频

时间:2012-02-11 14:15:24

标签: jquery asp.net video video-processing

我想在我的页面中显示YouTube视频。

http://www.youtube.com/v/u1zgFlCw8Aw?fs=1

上面是它的网址。

我写了embed标签,但无法正确完成。

我可以嵌入标签或其他任何方式在我的网站上使用其网址显示管视频吗?

1 个答案:

答案 0 :(得分:0)

如下所示:Embedding a Youtube video

.aspx

中的

<asp:Label ID="LabelShowYouTubeVideo" runat="server"></asp:Label>
.aspx.cs 代码隐藏文件中的

// this is the YouTube Video ID, here you replace by 
// the code of the one you want to show
string VideoID = "nQJACVmankY";

// Here this code you show in the label the YouTube Video that you put the code
LabelShowYouTubeVideo.Text = "<object width='425' height='355'><param name='movie' value='http://www.youtube.com/v/" + VideoID + "'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/" + VideoID + "' type='application/x-shockwave-flash' wmode='transparent' width='425' height='355'></embed></object>";

修改:添加部分:观看?根据需要到网址。我复制了我在ASP.NET论坛中发现的并没有自己运行它,但人们回答说它完美无缺!