473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Playing YouTube Videos In ASP.NET

233 100+
I am looking to play youtube.com videos in ASP.NET. I would use the embedded link that is available on the site, but I want to ability to change the source video link based on button clicks. Any help would be appreciated.
Jul 27 '09 #1
4 12661
Don't really understand what you're wanting to do. It seems like that's just some simple html.

Are you wanting a "Next Video" button? If so, do you have a list of videos that you want the user to be able to scroll through? Or something completely different?
Jul 27 '09 #2
mcfly1204
233 100+
I want there to be a default video on the page load. Underneath this, I would put a but for video 2, another for video 3, and so on. OnClick would change the source from the default video to that of video 2 or 3 or 4.
Jul 27 '09 #3
It would use an updatepanel with the button click as the trigger.

This is what I've come up with so far. The button would now have to be programmed to cycle through the videos

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7.     <title>Untitled Page</title>
  8. </head>
  9. <body>
  10.     <form id="form1" runat="server">
  11.     <div>
  12.     <asp:ScriptManager ID="ScriptManager1" runat="server">
  13.                 </asp:ScriptManager>
  14.         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  15.             <ContentTemplate>
  16.  
  17.                 <embed runat="server" id="Video1" src="http://www.youtube.com/v/MUl0oKQmnus&hl=en&fs=1&" 
  18.     type="application/x-shockwave-flash" allowscriptaccess="always" 
  19.     allowfullscreen="true" width="425" height="344"> </embed>
  20.             </ContentTemplate>
  21.             <Triggers>
  22.                 <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
  23.             </Triggers>
  24.         </asp:UpdatePanel>
  25.     </div>
  26.     <asp:Button ID="Button1" runat="server" Text="Button" />
  27.     </form>
  28. </body>
  29. </html>
This site shows how to update with a random picture on a timer, but you can modify it a little to use videos and buttons instead of a timer, like I've started to do. http://weblogs.asp.net/dmiyamasu/arc...and-timer.aspx

It's in C#, which I know very little about, and I'm trying to translate it into VB.

I'll let you know if I figure it out. You may beat me to it :D\

Jesse
Jul 27 '09 #4
mcfly1204
233 100+
I suppose I should have noted that I was not concerned with whether or not the entire page update, so an updater panel is not necessary. I came up with a very simple, possibly dirty, solution.

Expand|Select|Wrap|Line Numbers
  1. <html xmlns="http://www.w3.org/1999/xhtml" >
  2. <head runat="server">
  3.     <title></title>
  4.     <script runat="server" type="text/C#">
  5.         protected void PlayVideo(string url)
  6.         {
  7.             VideoPlayer.Attributes["src"] = url;
  8.         }
  9.         protected void VideoSRC1(object sender, System.EventArgs e)
  10.         {
  11.             PlayVideo("http://www.youtube.com/v/SQDlsbn349Y");
  12.         }
  13.         protected void VideoSRC2(object sender, System.EventArgs e)
  14.         {
  15.             PlayVideo("http://www.youtube.com/v/9joKTNM_DaM");
  16.         }
  17.         protected void VideoSRC3(object sender, System.EventArgs e)
  18.         {
  19.             PlayVideo("http://www.youtube.com/v/P7YkJxQT_0Y");
  20.         }
  21.     </script>
  22. </head>
  23. <body>
  24.     <form id="form1" runat="server">
  25.     <div>
  26.     <embed runat="server" id="VideoPlayer" src="http://www.youtube.com/v/SQDlsbn349Y" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"> </embed>
  27.     </div>
  28.     <asp:LinkButton ID="LinkButton1" OnClick="VideoSRC1" runat="server">Video 1</asp:LinkButton><br />
  29.     <asp:LinkButton ID="LinkButton2" OnClick="VideoSRC2" runat="server">Video 2</asp:LinkButton><br />
  30.     <asp:LinkButton ID="LinkButton3" OnClick="VideoSRC3" runat="server">Video 3</asp:LinkButton><br />
  31.     <div><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/A5xRqVZgE-c&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/A5xRqVZgE-c&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></div>
  32.     </form>
  33. </body>
  34. </html>
Jul 28 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: AngelDude | last post by:
I've done loads of googling trying to find an answer to this question....so advice, experience would be appreciated. I downloaded a software application last week and among other things, it...
0
by: Brian Schmalisch | last post by:
Hello, I hope that you can help me. I submit a character string to my application with several videos. I then would like to play these files as an endless loop after each other in the WMP. How...
1
by: linksterman | last post by:
I want to make a simple app to overlay subtitles on youtube videos. Is there a way to do this and keep the files hosted on youtubes servers (eg just overlay the text with another flash app)? I...
0
by: jayfer | last post by:
I'm not sure if this is the right thread, considering I have no idea how to do this. I'm designing a website for a friend who wants his youtube videos to be on the site. I'd like to make it so when...
0
by: Baltej Singh | last post by:
Here i am going to elaborate more about my query! I am building an online web application, in which i using TCPDF PHP Library (http://www.tcpdf.org), i am able to add all HTML Content there, but i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.