Tag: Standards

Embedding Multimedia Objects While Supporting Standards

In December I posted an entry called Embedding Flash While Supporting Standards as an improved suggestion over the Flash Satay Method. I’ve recently been playing with objects such as Windows Media and Quick Time where the Satay Method doesn’t even begin to work. As it turns out the Gillay method works for all types of objects (and allow me to re-emphasize that it works without javascript).

Before I get too far, let me show an updated example of the Gillay method. This example will appear slightly different than the examples in my other post but reflects further discussion that took place within the comments section of that post.

<!–[if IE]>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase=
"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab
#version=7,0,19,0" width="780" height="590" id="gilluminate">
<param name="movie" value="gilluminate.swf" />
<![endif]x–>
<!–[if !IE]> <–>
<object type="application/x-shockwave-flash" data="gilluminate.swf" width="780" height="590" name="gilluminate">
<!–> <![endif]–>
<param name="movie" value="gilluminate.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#2C676C" />
<p>gilluminate is mostly a showcase of things I have done, things I am doing, and things I can do. It is powered by a combination of HTML, Flash, ActionScript, XML, JavaScript, CSS and PHP and displays my recent websites and artwork.<br />You need the latest free <a href="http://www.macromedia.com/shockwave/download/download.cgi?
P1_Prod_Version=ShockwaveFlash">Flash Player Plugin</a> to view this site.</p>
</object>

Basically what is happening here is that I’m hiding the IE friendly object tag from every browser that’s not IE, and vice versa.

This same principal can be applied when "embedding" Windows Media or Quick Time movies, and probably every other type of object. Here’s an example of using the Gillay method with Quick Time:

<!–[if IE]><object classid=
"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="250" height="140" codebase="http://www.apple.com/qtactivex/qtplugin.cab
#version=6,0,2,0" standby="Loading Quick Time components…"><![endif]x–>
<!–[if !IE]> <–>
<object type="video/quicktime" data="example.mov" width="$width" height="$height" standby="Loading Quick Time components…">
<!–> <![endif]–>
<param name="controller" value="true" />
<param name="type" value="video/quicktime" />
<param name="autoplay" value="true" />
<param name="scale" value="aspect" />
<param name="BGCOLOR" value="#000000" />
<param name="target" value="myself" />
<param name="src" value="example.mov" />
<param name="pluginspage" value="http://www.apple.com/quicktime/download/" />
<a href="http://www.apple.com/quicktime/download/">Quick Time Player</a> required or <a href="#" onclick="window.close();">close this window</a> and select a different format.
</object>

This code will play the example.mov movie in Firefox, IE, Safari, and IE for Mac and will validate on the W3C website

Bookmark and Share

1 Response  |  add yours »

Embedding Flash While Supporting Standards (and without javaScript)

An even better improvement to the Flash Satay and Flash Javay methods

I’ve been looking at the Flash Satay method of maintaining valid markup using flash (the <embed> tag commonly used for non-IE browsers is no longer supported by current versions of HTML and XHTML). It always seemed a little wacky and time consuming to have to load your flash content into a container .swf and was not appealing to me at all. The Flash Javay method tries to address this problem, but I never liked the idea of using that much javaScript either. I mean, haven’t we spent the past few years trying to come up with a Flash detection that doesn’t use javaScript? The Javay method seems like a step backward, not forward.

Before I share my newly found solution to both problems, let me share this little newly found secret about Internet Explorer that might be useful to you in many other applications other than embedding Flash. Using the following code will only show up in Internet Explorer browsers:

<!--[if IE]>You are using IE!<![endif]-->

Now that we’ve got that out of the way, lets discuss what I’ve dubbed the Flash Gillay method. (Because everyone who comes up with a modified version of the Satay method has given it a new name, I’ve decided to name this one after myself in hopes for fame and fortune!) The general idea is to use the <object> tag exactly as it is commonly used, but to replace the <embed> tag with the Satay formatted <object> tag. Putting the Satay format inside the common format will work fine for browsers that would otherwise need the <embed> tag without any other code to help it out. For example, the following code will work in FireFox/Mozilla/Netscape without any problems:

<object

classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

codebase="http://download.macromedia.com

/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"

width="400" height="300" id="movie" align="">

<param name="movie" value="movie.swf" />

<object type="application/x-shockwave-flash"

data="movie.swf" width="400" height="300">

</object>

</object>

Notice that there’s no need for a container movie.

Now of course, IE browsers are going to CHOKE on this trying endlessly to load the second object. Here’s where the above mentioned trick comes in handy. Without using any Javascript at all, we can hide the second object from IE browsers by using the following:

<object

classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

codebase="http://download.macromedia.com

/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"

width="400" height="300" id="movie" align="">

<param name="movie" value="movie.swf" />

<!--[if !IE]> <-->

<object type="application/x-shockwave-flash"

data="movie.swf" width="400" height="300">

</object>

<!--> <![endif]-->

</object>

And as for the need for an alternate image or text to appear if Flash is not installed, you can now take it a step further and be even more standards compliant than the Satay method by making your alt text readable by screen readers:

<object

classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

codebase="http://download.macromedia.com

/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"

width="400" height="300" id="movie" align="">

<param name="movie" value="movie.swf" />

<!--[if !IE]> <-->

<object type="application/x-shockwave-flash"

data="movie.swf" width="400" height="300">
Description of Flash Content for screen readers

</object>

<!--> <![endif]-->

<!--[if IE]>

Description of Flash Content for screen readers

<![endif]-->

</object>

Notice the use of <–> and <!–> to trick non IE browsers into thinking that their respective lines end the comment and continue to render what’s inside the IF statement.

Now you can use the latest recommended Flash detection methods making it un-necessary to have your alt content point to a flash download page.

I have tested this method on IE 6.0, IE 5.5, Firefox 1.0, Mozilla 1.5, Netscape 7.0, Opera 7.1, Safari 1.0.2, IE 5.2 Mac, and yes, even Netscape 4.8. If you see any flaws in this method, I’d love to hear about it via email (I apologize for the lack of commenting capabilities on this blog, I’m still working on it).

This method can be seen in practice at http://www.gilluminate.com/

(12-21-2004 NOTE: Thanks to Stephen Rider for pointing out to me that about 8 months prior to this blog this method already existed as the Hixie Method. I maintain that I wasn’t aware of the Hixie Method at the original writing of this blog and apologize for the repeat.)

(01-17-2005 NOTE: If you plan to use the SetVariable command, you can still use id=”" for the IE version but you should use name=”" for the other version.)

(02-01-2005 NOTE: Comments are now turned on.)

(05-17-2005 NOTE: For information on why this method is more standards compliant than the Satay method, see the W3C Rules for rendering objects. Also, if IE followed these rules completely, they would not choke on the inner object tag, but only render the outter, and there would be no need for the extra IE only code.)

Bookmark and Share

38 Responses  |  add yours »

Search