treehouse : what would you like to learn today?
Web Design Web Development iOS Development

[Solved] Stretch YouTube Videos To Fit the Browser Window, Better Than Full Screen but I can't get it to work

  • I need the video on my site to stretch and contract to the screen size or as small as a cell phone screen. I'm always going to use the header on all the pages on all my sites. I'll either have a photo, video, background image or rss feed underneath. Like google web search engine. I just need everything to always resize...

    Here's the how to example I can't get work...
    http://labnol.blogspot.com/2007/09/stretch-youtube-videos-to-fit-browser.html

    streachable video i'm talking about
    http://www.youtube.com/v/vr3x_RRJdd4

    Here's my site I can't get to work...
    crossroads.site50.net




  • I made a youtube player script which farms a log file for youtube videos a while ago. I had your issue.

    Stop using object as a way to embed the youtube, there is a new way.
    Examine the code below, the 'xxxxxxxxxx' is the video ID.

    <div id="youtubevideo" align="center">
    <iframe title="YouTube video player" width="100%" height="100%" src="http://www.youtube.com/embed/xxxxxxxxxx?autoplay=1&quot; frameborder="0" allowfullscreen="">
    </iframe>
    </div>


    I hope that helps, that will fit to the screen, just change the body margins to center it or make it smaller. Look at the css and html on the script I made if you're stuck.

    #Edit: If It says no data received it's a transmission error with some browsers, just hit F5 and it will load. (thats for my site, not the suggested youtube embed code)
  • thanks for the tip mr. stagger. It works perfectly inside the div.