SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Evangelist
    Join Date
    Jul 2008
    Location
    Port Elizabeth, South Africa
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Embedding YouTube - param + object

    Hi - I'm trying to keep my code down for mobiles. When I embed a youtube video, do I have to include the whole shebang they give, viz:

    <object width="480" height="295">
    <param name="movie" value="http://www.youtube.com/v/CuZAX18sSWE&hl=en&fs=1"></param>
    <param name="allowFullScreen" value="true"></param>
    <param name="allowscriptaccess" value="always"></param>
    <embed src="http://www.youtube.com/v/CuZAX18sSWE&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="295">
    </embed></object>

    Or can I leave out object + param, and just do this:

    <embed src="http://www.youtube.com/v/CuZAX18sSWE&hl=en&fs=1" type="application/x-shockwave-flash"
    allowscriptaccess="always" allowfullscreen="true" width="480" height="295">
    </embed>

    Also is there any way - after viewer has watched video - to return it to its original youTube screen? Currently I get my video reduced into a small square in the center at the end, with a bunch of other videos under it that viewers can click. I tried deleting "allowscriptaccess" but that did not work.

    thanks, Val

  2. #2
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,782
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    I think it's just how youtube does their code. I don't know much about params but youtube set it up to look for related videos so I doubt you can change that.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  3. #3
    SitePoint Addict
    Join Date
    Feb 2009
    Location
    Austin Texas
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't kill the object tag, kill the embed tag. The embed tag isn't standards compliant.
    Code:
    <object 
    type="application/x-shockwave-flash"
    width="400" height="300">
    <param name="movie" value="movie.swf" /> 
    </object>

  4. #4
    SitePoint Evangelist
    Join Date
    Jul 2008
    Location
    Port Elizabeth, South Africa
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Vanish - that works! short 'n sweet code, very grateful.

    Looks like Ryan is right, I can't stop it from looking for related videos.

    Val

  5. #5
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,782
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Your welcome . I figured as much because it isn't your script. Cheers.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  6. #6
    SitePoint Evangelist
    Join Date
    Jul 2008
    Location
    Port Elizabeth, South Africa
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Vanish - your code won't load in FF. I read at

    http://alistapart.com/articles/flashsatay

    that I have to add this

    data="http://www.youtube.com/v/CuZAX18sSWE&hl=en&fs=1"

    before the width + height. So entire valid code reads:

    <object type="application/x-shockwave-flash" data="http://www.youtube.com/v/CuZAX18sSWE&hl=en&fs=1"
    width="480" height="295">
    <param name="movie" value="http://www.youtube.com/v/CuZAX18sSWE&hl=en&fs=1" /></object>

    The problem with this is that IE loads the entire movie (does not stream) before it will show youtube pic.

    He does give a hack for it, but only if you're able to create the movie yourself. I used animoto.com to convert static photos into a video, so I can't do what he says.

    It seems there's no way round it.

    (1) Embed works x-browser but validator throws it out, it's not part of xhtml specs. I'm too scared of leaving anything in that validator throws out because I don't want to trigger quirks mode.

    (2) If I leave out data=, FF doesn't show youtube pic to click on

    (3) If I include data=, IE loads the entire video before showing youtube pic to click on

    I decided to go with (3) as the lesser of all evils, for adding youtube.

    Am I doing the right thing?

    thanks, Val

  7. #7
    SitePoint Evangelist
    Join Date
    Jul 2008
    Location
    Port Elizabeth, South Africa
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    btw, you also have to change utube's "&" into "&amp;" for it to pass as xhtml transitional, so the final link for "data" and "value" reads:

    "http://www.youtube.com/v/CuZAX18sSWE&amp;hl=en&amp;fs=1"

    See - http://www.htmlhelp.com/tools/valida...blems.html#amp

    Val

  8. #8
    SitePoint Evangelist
    Join Date
    Jul 2008
    Location
    Port Elizabeth, South Africa
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi - the way to delete the youtube blurb (showing related videos at the end of your video) is to reduce the height and width. Then all you see at the end is the "Replay" button in the center of the screen.

    YouTube wuz sending my visitors straight to all my competitors! A simple reduction in height + width empties its head of all that nonsense.

    Cool !!! - Val

  9. #9
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,782
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    I would have just used a div over there to hide it, but it wouldn't be full proof so your idea was good
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  10. #10
    SitePoint Zealot infinique's Avatar
    Join Date
    May 2009
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vanishdesign View Post
    Don't kill the object tag, kill the embed tag. The embed tag isn't standards compliant.
    Code:
    <object 
    type="application/x-shockwave-flash"
    width="400" height="300">
    <param name="movie" value="movie.swf" /> 
    </object>
    Vanish the code is really sweet. Good job.

  11. #11
    SitePoint Member koolkat2009's Avatar
    Join Date
    Jun 2009
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it Ok to do that? I read in Youtube TOC that you are not allowed to change the embed code!
    KoolKat


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
  •