473,396 Members | 2,030 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,396 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 12667
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.