SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question No embed tag in xhtml, so how to use object tag

    I put up a page with doctype xhtml1 strict. Purpose of the page is to display a video in the quicktime player. I used some code I found on the web with embed tags.

    Code:
    <embed src="../movies/ugly_duckling.m4v" pluginspage="http://www.apple.com/quicktime/" width="720" height="560" controller="true" loop="false" autoplay="true" name="The Ugly Duckling"></embed>
    The page would not validate, because there is no embed tag in xhtml. Worked fine, though. A little research let me to the understanding that I need to use the object tag. Poking around a bit more, I found a few examples of the use of the object tag to place a quicktime player on an xhtml page, but they looked pretty intimidating and were all many years old

    What I'd like is a link to a current page or discussion that details how to call the Quicktime player to display video on an xhtml page. Thank you!

  2. #2
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    You could create an EMBED element with eXtensbilty of XHTML. ;-) Though obviously you'd prefer to use the OBJECT which theoretically SHOULD be a simple job.

    But there are various methods you can use since plugins and various browsers can have their own "little foibles" and bugs.

    This is an old article there are probably better http://www.alistapart.com/articles/byebyeembed/ but it explains some browser issues.

  3. #3
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your reply underscores the impression I got when I tried to research this issue: All the solutions have their problems. Perhaps this will be solved in html 5. Meanwhile, I'll just ignore the W3C Validator and use my page, since it works for those people it needs to work for.

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    embed only works in some browsers whereas object works in all browsers (except that for some types of object you will need a second object tag for IE6 with slightly different settings - the byebyeembed article showsd you how to add the second object tag when a single one will not work for IE6 and for other browsers).

    embed is a proposed addition to HTML in version 5 and doesn't exist prior to that version. It is a completely unnecessary addition since the problems with object are all related to IE6 which will be long gone by the time HTML 5 is finished.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @ felgall - I don't feel the need to support IE6. The sooner it dies the better. Meanwhile, I was surprised by the complexity of even the lesser task of supporting the current crop of browsers. It sounds like you are saying I could use a simpler version of the Object method, without the nested fallbacks. I was also surprised that the discussion dates fro 2006. Here we are almost to 2011, and it looks like things haven't improved much.

  6. #6
    SitePoint Guru Chroniclemaster1's Avatar
    Join Date
    Jun 2007
    Location
    San Diego, CA
    Posts
    784
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Polimon Design View Post
    @ felgall - I don't feel the need to support IE6. The sooner it dies the better. Meanwhile, I was surprised by the complexity of even the lesser task of supporting the current crop of browsers. It sounds like you are saying I could use a simpler version of the Object method, without the nested fallbacks. I was also surprised that the discussion dates fro 2006. Here we are almost to 2011, and it looks like things haven't improved much.
    You are so correct. For all the progress we've made in other areas, you would think that we would not still be discussing something this simple after half a decade.

    However, Mozilla doesn't really support the <object> tag properly either. Until the W3C stops arguing over competitive advantage, I don't expect to see a solution to this either. Adobe has done a good job of splitting the difference. I'm in favor of standards, and the Adobe object/embed combination they've developed works in every important browser (including IE6). That's a standard... it's not the W3C's standard... but it's a standard nonetheless. This is a case where know the rules you're breaking and you have a good reason. I really don't understand why people are so gung ho to implement all these funky solutions (most of which drag in JS) when there's a highly reliable XHTML solution that's thoroughly tested and running reliably and fully cross-browser on thousands of production websites.
    Whatever you can do or dream you can, begin it.
    Boldness has genius, power and magic in it. Begin it now.

    Chroniclemaster1, Founder of Earth Chronicle
    A Growing History of our Planet, by our Planet, for our Planet.

  7. #7
    Resident curmudgeon bronze trophy gary.turner's Avatar
    Join Date
    Jan 2009
    Location
    Dallas
    Posts
    990
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chroniclemaster1 View Post
    However, Mozilla doesn't really support the <object> tag properly either.
    Would you please expand on that?

    As to W3 standard markup, the problems lie with IE. I noticed even IE9b still depends on an Active-X object, so the markup causes problems for other browsers. HTML provides a solution in the form of alternative content. Again, older IEs are a problem in that alternative content causes them rendering issues. My solution has been to wrap the alternative content in a conditional comment.
    Code:
      <div>
        <object classid="clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b"
                codebase="http://www.apple.com/qtactivex/qtplugin.cab">
          <param name="src" 
                     value="movie.mp4" />
          <param name="autoplay" 
                     value="false" />
          <param name="controller" 
                     value="true" />
    
    <!--[if !ie] -->
          <object type="video/mp4" 
                  data="movie.mp4">
            <param name="controller" 
                       value="true" />
            <param name="autoplay" 
                       value="false" />
            <p>oops</p>
          </object>
    <!--[endif]-->
        </object>
      </div>
    Note that Quicktime seems to require explicit dimensions, either from CSS or html attributes.

    //edit: See HTML scripting guidelines from Apple.

    cheers,

    gary
    Anyone can build a usable website. It takes a graphic
    designer to make it slow, confusing, and painful to use.

    Simple minded html & css demos and tutorials

  8. #8
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @ Gary Turner - Thanks for that Apple link. That is exactly what I was looking for.

  9. #9
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by gary.turner View Post
    As to W3 standard markup, the problems lie with IE. I noticed even IE9b still depends on an Active-X object, so the markup causes problems for other browsers. HTML provides a solution in the form of alternative content. Again, older IEs are a problem in that alternative content causes them rendering issues. My solution has been to wrap the alternative content in a conditional comment.
    Code:
      <div>
        <object classid="clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b"
                codebase="http://www.apple.com/qtactivex/qtplugin.cab">
          <param name="src" 
                     value="movie.mp4" />
          <param name="autoplay" 
                     value="false" />
          <param name="controller" 
                     value="true" />
    
    <!--[if !ie] -->
          <object type="video/mp4" 
                  data="movie.mp4">
            <param name="controller" 
                       value="true" />
            <param name="autoplay" 
                       value="false" />
            <p>oops</p>
          </object>
    <!--[endif]-->
        </object>
      </div>
    Note that Quicktime seems to require explicit dimensions, either from CSS or html attributes.

    //edit: See HTML scripting guidelines from Apple.

    cheers,

    gary
    But IE7 and later will work quite happily using the activex without specifying the classid and so will work using the same object as other browsers using the type attribute to work out which classid to internally apply.

    With modern flash you can even get IE6 to work with a single object tag.

    Just avoid using classid and provided you set up all the right param values you can get a single object to work across all popular browsers except IE6. It is only when you start using classid that things get complicated.

    So the following should be all you need:

    Code:
    <object type="video/mp4" 
                  data="movie.mp4">
            <param name="controller" 
                       value="true" />
            <param name="autoplay" 
                       value="false" />
            <p>oops</p>
          </object>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •