SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Embedding youtube videos

    Hi,

    I am having some trouble embedding youtube videos. I of course know about the simple embed code within youtube itself but I am trying to replicate the videos (not coded by me) that are present here: http://jamesgoodwin.co.uk/new-site/listen.html and add new clips (along the bottom row)

    The code is:

    <object width="300" height="300" style="float: left;padding: 5px;">
    <param name="movie" value="http://www.youtube.com/v/5bwdxPw3qNI&hl=en&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1" />
    <param name="allowFullScreen" value="true" />
    <param name="allowscriptaccess" value="always" />
    <embed src="http://www.youtube.com/v/5bwdxPw3qNI&hl=en&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1" width="300" height="300" align="middle" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"></embed>
    </object>

    I have tried copying the code above and replacing the youtube URL unique to a different video within the 'value' and the 'embed src' tags but this doesn't seem to work.

    Can anyone advise how to replicate this kind of embedding method with other video clips?

    It would be greatly appreciated.

    Sam

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,165
    Mentioned
    453 Post(s)
    Tagged
    8 Thread(s)
    You can just play with the URLs a bit. For example, if I take a YouTube vid at random, the URL looks like this:

    https://www.youtube.com/watch?v=5MzLfzCn8_4

    But that doesn't follow the same pattern as you see in your code:

    http://www.youtube.com/v/5bwdxPw3qNI

    But you can modify the new link to follow the same pattern:

    https://www.youtube.com/v/5MzLfzCn8_4

    Paste that into your code, and it works fine:

    Code:
    <object width="300" height="300" style="float: left;padding: 5px;">
    <param name="movie" value="https://www.youtube.com/v/5MzLfzCn8_4&hl=en&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1" />
    <param name="allowFullScreen" value="true" />
    <param name="allowscriptaccess" value="always" />
    <embed src="https://www.youtube.com/v/5MzLfzCn8_4&hl=en&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1" width="300" height="300" align="middle" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"></embed>
    </object>
    So basically, just take the last part of any YouTube URL (after the = sign) and paste it into your code here:

    Code:
    <object width="300" height="300" style="float: left;padding: 5px;">
    <param name="movie" value="http://www.youtube.com/v/5bwdxPw3qNI&hl=en&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1" />
    <param name="allowFullScreen" value="true" />
    <param name="allowscriptaccess" value="always" />
    <embed src="http://www.youtube.com/v/5bwdxPw3qNI&hl=en&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1" width="300" height="300" align="middle" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"></embed>
    </object>

  3. #3
    SitePoint Evangelist silver trophybronze trophy
    Join Date
    Jul 2013
    Posts
    406
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)
    Yes, in this way Google's "old embed code" with Flash should be working.
    But ... wasn't it so, that Ipad & Iphone don't support Flash?
    If you want to make Ipad & Iphone visitors also happy with the videos, you have to use the "new code" with an <iframe>: that is working with Flash and html5.
    Code:
    <iframe width="420" height="315" 
       src="//www.youtube.com/embed/5bwdxPw3qNI?rel=0" 
       frameborder="0" allowfullscreen>
    </iframe>

  4. #4
    SitePoint Member
    Join Date
    Jun 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile yout tube embed issue ressolved

    Quote Originally Posted by Francky View Post
    Yes, in this way Google's "old embed code" with Flash should be working.
    But ... wasn't it so, that Ipad & Iphone don't support Flash?
    If you want to make Ipad & Iphone visitors also happy with the videos, you have to use the "new code" with an <iframe>: that is working with Flash and html5.
    Code:
    <iframe width="420" height="315" 
       src="//www.youtube.com/embed/5bwdxPw3qNI?rel=0" 
       frameborder="0" allowfullscreen>
    </iframe>
    Hi ralph.m,

    Thanks for this, I was replacing the straight youtube URL into the existing code but I wasn't adding the &h1 after the youtube link which resolved the issue. I'm not sure why.

    Thanks for your help, appreciated.

    Sam

    ------------------------------------------------------------

    Francky,

    Thanks for this too, I'm sure they'll want a decent response from mobile and tablets so I will experiment with this too.

    Cheers, Sam


Tags for this Thread

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
  •