Flash SWFObject Macro

repository-plugin: Unable to find a plugin by the key 'com.wikiconsulting.swfobject' for the profile 'default'

Self-upgrading Flash Video plugin

This macro is presented as an alternative to the built-in Confluence library for embedding flash and as an improvement to Flash Plugin. It is a wrapper for Deconcept's SWFObject, an extensive javascript library (previously named FlashObject) for embedding flash, handling many browers and giving users an upgrade path.

To quote SWFObject

SWFObject is a small Javascript file used for embedding Adobe Flash content. The script can detect the Flash plug-in in all major web browsers (on Mac and PC) and is designed to make embedding Flash movies as easy as possible. It is also very search engine friendly, degrades gracefully, can be used in valid HTML and XHTML 1.0 documents*, and is forward compatible, so it should work for years to come.

History 

Main swfobject macro code

<!--
By Martin Cleaver, wikiconsulting.com
1. Download the swfobject.js and save it as an attachment on a page. Note the page id
1. Save this code as a user macro called swfobject
2. alter the javascript src to point to the right page id
3. customize the invokeVideo macro to embed your preferred height & width parameters
$param0 = 1835322 where 1835322 is pageId
$param1 = moviefile.swf
$param2 = title
$param3 = width
$param4 = height
$param5 = flash version needed
$param6 = background
-->

<script type="text/javascript" src="/download/attachments/1835322/swfobject.js"></script>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<div id="flashcontent">
{include:Vision - Video}
</div>

<script type="text/javascript">
&nbsp;&nbsp; var so = new SWFObject("/download/attachments/$param1/$param2", "$param3", "$param4", "$param5", "$param6");
&nbsp;&nbsp; so.addParam("BASE", "/download/attachments/$param1");
&nbsp;&nbsp; so.write("flashcontent");
</script>

invokeVideo

Simpler code I use for standardising parameters. Save this as an additional user macro named invokeVideo or similar.

{swfobject:ignored|$content.getId()/|$param0|Title|720|480|8|#ffffff};

Usage:

{invokeVideo:videoFile.swf};

This will:

  1. Ensure you have Flash 8 installed (hence the "8" parameter)
  2. Set up the environment for picking up the video clip, and any associated files from the attachments from the page directory (that's content.getId())
  3. Run the attachment videoFile.swf named in the usage invocation using 720x480 resolution on a white (#ffffff) background

Limitations

  1. As this is a user macro, there is no provision for named parameters, nor proper packaging as a JAR file.
  2. Not all the parameters accepted by swfobject are represented in the macro.
  3. It would be nice to be able to add multiple BASE parameters, as some SWF's include multiple FLV files.

No warranty or support

  1. I present this as-is, without warranty. Unless I am contracted to do so, I am unlikely to update it as it now serves my client's needs, however you are welcome to update it.

Labels

flash flash Delete
macro macro Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 21

    Tomi Strugar says:

    I have tried to use your macro but am unclear about a few things: a. For the us...

    I have tried to use your macro but am unclear about a few things:

    a. For the user macros, swfobject & invokeVideo, what should the setting for 'Macro has a body' & 'Output' be?

    b. What is meant by

    2. Set up the environment for picking up the video clip, and any associated files from the attachments from the page directory (that's content.getId())

    To display a swf file on the same page as I am attaching it to, do I use just

    {invokeVideo:filename.swf}
    or do I need a ' ^ ' as well? ie.
    {invokeVideo:^filename.swf}

    c. Why in your examples is there a semicolon after the wiki markup for these macros?