PDA

View Full Version : Resolved loading a youtube video into div using dynamic ajax content



cookie44
06-04-2009, 01:40 PM
1) Script Title: dynamic ajax content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem:
ok first off, is this possible? I would like to load or embed a youtube video into a div tag using links within the page, each link would load a different video in the same space.

I already have the dynamic ajax content script working on my homepage to load updates into a separate box from links on the side, unfortunately I don't have a link to show you what I mean.

I have very little experience in web design, and it's a miracle I gotten this far with my site, so if this is the wrong way to go about doing this please let me know.
thanks

molendijk
06-04-2009, 05:40 PM
If you already know how to load files in the box, then the only thing you have to do is this: in a file you want to show in the box, put something like
<iframe src="http://www.youtube.com/v/fnknjPXCM8I&hl=nl&fs=1&" style="position:absolute;width:550px;height:100%"></iframe>.
===
Arie Molendijk.

cookie44
06-04-2009, 05:59 PM
I'm afraid that didn't work, I need some way of actually embedding the video player into the page from youtube, not a saved file in my directory. Here's the code youtube suggests using:

<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/Y8wxB_PnoyQ&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Y8wxB_PnoyQ&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

now that works, but it simply puts the video and player in the box, whereas I only want it to do that once the link to the right is clicked on

molendijk
06-04-2009, 06:10 PM
That's odd. It works on my side! It's not a saved file.
===
Arie.

cookie44
06-04-2009, 06:11 PM
could you post me a link to your site so i can have a look at your source? thanks

molendijk
06-04-2009, 06:22 PM
I made a quick one for you here (http://molendijk.110mb.com/ajax/).
===
Arie.

cookie44
06-04-2009, 06:23 PM
thats wicked mate thanks a lot, now I shall dissect it and figure out where I went wrong :)

cookie44
06-04-2009, 06:25 PM
ok could you tell me what you have inside your 'ajaxfiles/external.htm' file to get the just the video to load?

molendijk
06-04-2009, 06:38 PM
The file has this:
<iframe src="http://www.youtube.com/v/fnknjPXCM8I&hl=nl&fs=1&" style="position:absolute;width:550px;height:400px"></iframe>

Putting the right url in the iframe does the trick. From the embedding info given by YouTube, you just have to take the value of the first param. That's all.

===
Arie.

cookie44
06-04-2009, 06:49 PM
<iframe src="http://www.youtube.com/v/Y8wxB_PnoyQ&hl=en&fs=1&" style="position:absolute;width:480px;height:385px"></iframe>

sorry mate, i put the above into my file to be loaded, but it just loads the text above, not the actual video

molendijk
06-04-2009, 07:06 PM
Then I'm afraid there's an error on your page somewhere.
I put a download button on my page (link given above). Try to see why my page works whereas yours doesn't.
===
Arie.

cookie44
06-04-2009, 07:21 PM
absolute legend mate, fixed it, thanks for the download and all the help. as per usual, working backwards gives the most progression :)

cheers

molendijk
06-04-2009, 07:45 PM
Glad I could help you.
===
Arie.

cookie44
06-04-2009, 08:01 PM
I think I may have just single handedly crashed google's youtube servers with my frantic url grabbing :D

dastalker
06-05-2010, 02:10 AM
This one helped me alot too
I just wonder one thing..not youtube related thou

Is it possible to directly load an swf file in the div instead of html file with this script?
Then i dont have to make an html file for every flash file...
I tried just make the script target to an swf, but it just displayed a big bunch of symbols.

molendijk
06-05-2010, 09:31 AM
See this (http://www.let.rug.nl/molendyk/include_video_jw_and_others/include_video.html).
===
Arie.

miow
06-07-2010, 08:18 PM
By the way: *lol* The video from DailyMotion in the beginning is a bit strange. Because his name is "Johann Sebastian Bach" and definitly not "Jean".
Hey, i just say. :D
Really strange for german visitors to see this the for the first time.
It's from a german "alls". *lol*
But ok ok, who cares?
(notice to me: i have to learn more about the american/english language) ^_^

Best regards, the german miow

molendijk
06-07-2010, 11:39 PM
Hello German Miow,
Jean Sébastian Bach is the French name for Johann Sebastian Bach. The French have a tendancy to 'francisize' everything. For instance, they refer to Nijmegen (Dutch city) by Nimègue. Well, as long as they don't win the soccer World Cup, it's okay with me.
===
Arie.

miow
06-08-2010, 08:41 AM
Ahhh because of that. Right, i saw it on the TV Channel "Arte". Maybe you know the show "Karambolage". In this show was declared how the francaise people all languages "francecai"s"e". *rofl*
Rightz, knew it.

Haha....funny. :D

haidivolume
06-08-2010, 09:53 AM
name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Y8wxB_PnoyQ&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

molendijk
06-08-2010, 11:47 AM
...<embed src="http://www.youtube.com/v/Y8wxB_PnoyQ&hl=en&fs=1&rel=0&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed>...
The embed tag is deprecated, although YouTube uses it.
===
Arie.