Results 1 to 6 of 6

Thread: Having only one youtube player, but load other videos?

  1. #1
    Join Date
    Sep 2006
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Having only one youtube player, but load other videos?

    I wanted to embed some youtube videos on my site. I can get it to where I can have the videos to play in their own player. What I want to do is display one player and have links. When the link is pressed, load that youtube video into the player. Can this be done via JavaScript or php? Thanx

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Javascript, must like a rollover image.

    Basically, you would just replace the src of the video, or just switch out the divs.

    however, this is not a great idea in that you would need to reload the video each time.

    A better idea would be to have say 3 div elements, each with a video, and each set to hidden, except the one selected. Then use the javascript to switch the visibility of the one desired and turn the rest off.

    However, one possible issue here is sound and that the sound would likely continue from any hidden yet invisible movies.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2006
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I thought about that, using layers. Okay here is something.
    Here is the sample code for a youtube video.

    Code:
    <object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/pfLjLo3mclg"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/pfLjLo3mclg" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
    Only thing that would change in the next video is the src url. Couldn't we write something that would dynamically change the url when a link is pressed.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,028
    Thanks
    44
    Thanked 3,210 Times in 3,172 Posts
    Blog Entries
    12

    Default

    Flash is tricky. Using flash to display video is a little different than other flash applications like menus and what are called 'movies'. I've been playing with a flash version of a video and have found that the only sure fire way to get rid of it is to have it in an iframe and change the src of the iframe.

    That is what I would suggest here. Have an iframe on your page. Target it by name with links to pages, each containing one of the various flash videos.

    Trying to get them all on one page as a sort of effort at preloading may seem like a good idea but, even short videos are pretty big files so you are better off just letting each one stream in turn.

    Flash video (for the most part) is only for broadband anyway.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    It would be reliable but also force the video to reload each time.

    I think looking at a different solution would make sense.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Mar 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    What about something like Facebook.com's shared videos? I'm trying to achieve the same thing but their code is waaay too complicated for me to understand.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •