Comparing flash embedding techniques

by Think*thanks

This page was part of the Comparing flash embedding techniques post @ Think*thanks


List of browsers used during test:

Windows browsers

  • Internet Explorer 6 (IE6)
  • Internet Explorer 7 (IE7)
  • Opera 7.5x
  • Opera 9.1
  • Firefox 1.5
  • Firefox 2.0

Mac browsers

  • Internet Explorer 5.2
  • Opera 8.5.2
  • Firefox 1.5
  • Safari 2.0.4
  • Camino 1.0.3
  • Seamonkey 1.0.1

Linux browsers

  • Firefox 2.0
  • Mozilla 1.7

I submitted this page to 'browsershots.org'. So, to quickly check this page in different browsers: Click here.

The Adobe / Macromedia way

The code

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="420" HEIGHT="350" id="adobeWay">
<PARAM NAME=movie VALUE="http://youtube.com/v/rIFh1ydXWmg">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<EMBED src="http://youtube.com/v/rIFh1ydXWmg" quality=high bgcolor=#FFFFFF WIDTH="425" HEIGHT="350" NAME="adobeWay" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>



A closer look

GOOD
  • High Cross-browser compatibility
  • The 'classid' attribute loads the proper Flash player ActiveX control, which is a valid but browser-specific implementation.
  • The 'codebase' attribute tells the browser where to find the right flash Player for automatic download
  • Access to the internal accessibility features of the flash element remain
BAD
  • Complex: Dual implementation of 'embed' and 'object' elements
  • Invalid code (W3C) because of 'embed' element
  • Flash element needs to be activate by user (in Internet Explorer)

Link

Adobe TechNote

The Youtube way

The code

<OBJECT width="425" height="350">
<PARAM name="movie" value="http://www.youtube.com/v/EwEk62HViIA"></PARAM>
<PARAM name="wmode" value="transparent"></PARAM>
<EMBED src="http://www.youtube.com/v/EwEk62HViIA" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350">
</EMBED>
</OBJECT>



A closer look

GOOD
  • High Cross-browser compatibility
BAD
  • Complex: Dual implementation of 'embed' and 'object' elements
  • Invalid code (W3C) because of 'embed' element
  • No 'classid' attribute, no 'codebase' attribute
  • Flash element needs to be activate by user (in Internet Explorer)

Youtube movies internal features aren't supposed to be accesible



Link

Youtube

The nested-objects way

FAIL (the browser should render some flash content, not this).

The code

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="425" height="350">
<param name="movie" value="http://youtube.com/v/Cejq10jZ0kQ">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<!--[if !IE]> <-->
<object data="http://youtube.com/v/Cejq10jZ0kQ" width="425" height="350" type="application/x-shockwave-flash">
<param name="quality" value="high">
<param name="bgcolor" value="#FFFFFF">
<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
FAIL (the browser should render some flash content, not this).
</object>
<!--> <![endif]-->



A closer look

GOOD
  • Good Cross-browser compatibility
  • Valid code: No embed element
  • 'classid' attribute, 'codebase' attribute + pluginurl param
BAD
  • Complex: Dual implementation of 'object' element (!)
  • Flash element needs to be activate by user (in Internet Explorer)


Browser compatibility problems (during test)

Opera 7.5 on Windows didn't embed the flash element "FAIL (the browser should render some flash content, not this)."


Link

Ian Hickson

The short way (simple flash satay)

The code

<OBJECT data="http://youtube.com/v/mrW8ub2H3MY" type="application/x-shockwave-flash" width="425" height="350">
<PARAM name="movie" value="http://youtube.com/v/mrW8ub2H3MY">
</OBJECT>



A closer look

GOOD
  • Good Cross-browser compatibility
  • Simple code: Only use of 'object' element
  • Valid code: No embed element
BAD
  • No 'classid' attribute, no 'codebase' attribute
  • Flash element needs to be activate by user (in Internet Explorer)
  • Accessibility issues
  • Older versions of Safari ignore param tags


Browser compatibility problems (during test)

Opera 7.5 on Windows didn't embed the flash element, but I think it was because I did the test with a YouTube movie, where the flash elements only is linked by an ID-number and isn't a 'normal' file with .swf extension.
I used this technique earlier and there were no problems then. I'll review this again later.

This way of embedding made IE5.2 on Mac ignore the float: left; of the div containing the SWF. View screenshot.



Note

This embedding technique was usefull for me when I wanted to embed an flash element in a Plone-website (Plone is an open source content management system). The plone site used the Kupu editor to make the content management easier. But this plugin also "cleaned" the html code entered. The main problem was in the 'embed' element, so this method was a great way to work arround it.

For more information about this subject, please read my post about embedding flash elements in Plone.

Link

Drew McLellan

The UFO way

You need to upgrade your Flash Player
UFO gives the possibility to provide an alternative text if a Flash player isn't up-to-date / present.

The code

Link UFO javascript file (ufo.js) to your html document


<script type="text/javascript"> var FO = { movie:"http://youtube.com/v/1zN9gtrF7xI", width:"425", height:"350", majorversion:"6", build:"0" }; UFO.create(FO, "UFOway"); </script>

<div id="UFOway"> Replacement text </div>



A closer look

GOOD
  • Good Cross-browser compatibility
  • Simple implementation
  • Express Install feature
  • Automatic ActiveX control activation, so visitor doesn't need to activate the flash element
BAD
  • Javascript needed

Validation: UFO uses W3C DOM methods to insert the object element for all Gecko based browsers (e.g. Firefox, Mozilla, Netscape) and all other browsers that use both the Netscape plug-in API (e.g. Opera and Safari) and an XML MIME type.

UFO uses innerHTML to insert the object element for Internet Explorer



Browser compatibility problems (during test)

Internet Explorer 5.2 on Mac didn't embed the flash movie. "You need to upgrade your Flash Player"



Link

Bobby van der Sluis

The SWFObject way

You need to upgrade your Flash Player SWFObject gives the possibility to provide an alternative text if a Flash player isn't up-to-date / present.

The code

Link SWFObject javascript file (swfobject.js) to your html document


<script type="text/javascript"> var so = new SWFObject("http://youtube.com/v/0EW4SRxLczk", "SWFObject-way", "425", "350", "7", "#ffffff"); so.write("flashcontent"); </script>



A closer look

GOOD
  • High Cross-browser compatibility
  • Simple implementation
  • Forward compatible
  • Express Install feature
  • Automatic ActiveX control activation, so visitor doesn't need to activate the flash element
BAD
  • Javascript needed

Validation: Can be used in valid HTML and XHTML 1.0 documents when pages are sent as text/html, not application/xhtml+xml. So that makes SWFObject less W3C compliant then UFO.



Link

deconcept

The new way: SWFfix ?

SWFFix is a project where Geoff Stearns (from UFO) and Bobby van der Sluis (from SWFObject) try to unite their techniques / ideas with the goal to create the ultimate JavaScript library for embedding Flash content.

At the time of this post (februari 2006) they just started thinking, so no results yet.

More info: http://www.swffix.org/devblog/



This page is part of the Comparing flash embedding techniques post @ Think*thanks