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.

<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!

You could create an EMBED element with eXtensbilty of XHTML. :wink: 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.

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.

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.

@ 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.

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.

  <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

@ Gary Turner - Thanks for that Apple link. That is exactly what I was looking for. :slight_smile:

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:

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