Posting Multiple YouTube Videos with only One Player

Posted by lesseffective on March 12th, 2007
Buy Propecia Online Zyban Without Prescription Propecia No Prescription Amoxil For Sale Penisole Generic Buy Nizoral Online Nexium Without Prescription Cymbalta No Prescription Aricept For Sale Phentrimine Generic

So I’ve been trying to find a clean way to put a collection of Brian Regan videos on my fan site at allregan.com. I wasn’t able to find a satisfactory way online, so I had to get dirty and just figure out the javascript for myself. Let me give you the background and then the solution.

Background
I wanted to be able to play a bunch of videos on the same page, but without using 25 different windows (individual embedded videos). These get really long and make it hard to navigate the site. So, it was like this:

Texttexttexttexttexttexttexttexttexttexttexttext….

regan youtube SMALLER

Text
regan youtube SMALLER

Text
regan youtube SMALLER

Text
regan youtube SMALLER

etc…

I wanted this:

regan youtube bigger

Video 1 (this is a link that will change the single, larger player)
Text text text

Video 2
Text text text

etc…

Solution
I used javascript’s innerHTML property to fill in where I wanted the single player to be. I then made a function that would replace that coding with a variable I fed it (the unique video name of each video I wanted to embed). It would swap them out and the video auto-plays to make it a smooth looking transition. The function also jumps the viewer back up to where the video is playing so they don’t have to quickly scroll up or miss the beginning. It was a pretty simple solution, but I hadn’t seen anywhere to rip it off of online, so I had to make it myself. And I’m pretty dern happy with it. For the actual code, you can check out the Brian Regan Videos page on my site. Then just right mouse click and hit ‘view source.’ Yep. Pretty proud of it.


2 Comments

  • Dan said:

    That’s pretty rad, nice one

  • Jenna said:

    Hi there, this link isn’t working, and this is exactly the information I have been searching the web for for hours now for. -”(I wanted to be able to play a bunch of videos on the same page, but without using 25 different windows (individual embedded videos).”

    This if you are not sure what I am talking about lol.

    I would really appreciate the code, if you still have it around somewhere, and I will credit you on my webpage. — or if you could point me in the right direction!

    Thanks, Jenna


Post a Comment


Jacob Wishes He Was Aborted? | Home | A New Ringtone