The Object Plugin

This plugin is in beta!
Uses the
OBJECT html tag to embed arbitrary content into a wiki page, with a particular bent towards media: common media formats are detected and some "agnostic best-guess" html is used (derived from the (browser) plugin provider's recommended syntax). On IE, this is all you can do (
see below if you want a brief explanation of the tortured state of browser plugin syntax).
However, on the various Mozillae, any content at all can be embedded using the object tag: java, pdf, other html, svg, even images (although there is of course no reason to do so). The plugin uses generic syntax when it cannot detect the type of file being embedded, and it works generally well.
The plugin stores a range of default values (defined here on this page) which allow you to specify a bare minimum of info in your markup and still get consistent results (see
Basic Usage below). These defaults can of course be overridden on a use-by-use basis. (But it's also worth noting that some movies/media types/browser plugins will override these as well).
A
USEEMBED flag should be left to "true" - I thought I could be clever before I fully understood the minefield that is browser plugin syntax. Future releases may offer something like a "USEVALID" option, which will generate W3C compliant code which also works on (at least) IE and Mozilla.
The HTML generated does not address the imminent changes to IE content embedding rules (someone thinks they own a patent, so MS are changing how it works (again)), but a simple revision to the plugin will generate pages which work in IE 7 without any changes to your TWikiML.
Basic Usage
You
could call the plugin as simply as:
%OBJECT{"SomeMovie.mov"}%
This will detect that the embedded file is a QuickTime and use "media-like" syntax (and pass the correct
CLASSID to IE - why it can't work out which plugin to use is a little beyond me). However, unlike an IMG tag, plugins do not autosize to their content, and the movie would display at the default size. You could use media of only one size site-wide and specify the dimensions as defaults, but realistically the minimum markup you need to embed things into your wiki pages is:
%OBJECT{"SomeMovie.swf" width="320" height="180"}%
Advanced Usage
A call to the ObjectPlugin could get as complicated as:
%OBJECT{src="SomeMovie.wmv" width="320" height="180" controller="FALSE" play="TRUE" useembed="TRUE" myparam1="3.1419" myparam2="edinburgh"}%
Once you start passing a ton of parameters, you aren't gaining much by using the plugin, and you may actually be reducing the portability of your code, so it may be best to do your own HTML.

Including a "mime-type" parameter may help your browser choose which browser plugin to use more efficiently
Paramters
ObjectPlugin supports arbitrary parameters. If you pass it
cowtype="Jersey", that is passed on to the browser, both as a
<PARAM> tag and inside the optional
<EMBED> tag.
A few parameters are defined and get handled a little differently (they may be "translated" to a particular browser plugins syntax)
| Parameter |
Value |
Description |
Notes* |
| src |
URI |
the content to embed ("src=" is optional) |
| width |
std web measure (px, %, em) |
with of box holding content |
| height |
std web measure (px, %, em) |
height of box holding content |
| controller |
text boolean ("TRUE" or "FALSE") |
whether to display controls |
Honoured by QT, WM |
| play |
text boolean |
whether to auto-play the content |
often overridden by Flash movies |
| useembed |
text boolean |
DO NOT USE. Deprecated before it was born |
Recommended plugin syntax/Detection of media type
The plugin uses a hybrid of the html markup recommended by the browser plugin makers - in the hope of providing maximum compatibility. All known synonymous tags are sent set to the same value (e.g. QT's "AutoPlay", Flash's "Play" and WMV's "AutoStart" would be set to
TRUE,
TRUE and
1 and all passed). The reason for this is that there's no guarantee that a particular browser plugin will handle a particular media type: MP3, MPEG etc are handled by whatever browser plugin gets asked first, Windows Media is now handled by QuickTime on Macintosh systems
The source syntax recommendations are:
The plugin then does get specific, in order to work properly with IE: it detects common media types and inserts the correct
CLASSID value. This is done simply by checking the extension of the filename.
(I haven't bothered with Real. If there's huge demand, it wouldn't be hard to add)
Then everything is smoodged onto one line, TWiki doesn't like tags over line breaks, but I also noticed tables and Lists getting broken from line breaks added by the plugin, so one line for everything.
And (to keep the plugin reasonably simple)
all information passed inside
PARAM tags is also put in the
EMBED tag (and any special
EMBED only parameters go first).
In other words, all parameters recommended by the plugin maker are sent, plus more, and in any old order.
A brief history/explanation of browser embedding HTML syntax
The current state of the markup you have to use to get some non-natively supported content on to a web page only makes sense when you take into account its history:
Netscape started the whole 3rd-party browser plugin thing off with their proprietary
EMBED tag. The versions of IE that came out around that time (IE 3?) worked with Netscape plugins and the
EMBED syntax.
The
w3c decided not to adopt this tag as a standard and instead created the
OBJECT tag, which (as the name suggests) was meant to be a way of embedding anything at all in a very flexible way. The next release of IE used ActiveX, and required the
OBJECT tag, with a proprietary
CLASSID parameter (which IE used to choose which plugin should handle the content). So the world scrambled to change all web pages to use
both the nonstandard
EMBED and
OBJECT in a nonstandard way.
And the situation remains that way today: if you use only an
OBJECT tag in the MS way, all other browsers (even Microsoft's last IE for Mac) ignore the whole damn thing.
And it will change again. Thanks to
ArthurClemens for
pointing this out. It should be possible to alter this TWiki plugin to work the new way and remain fully compatible with this syntax.
This is an interesting article on getting "pure" OBJECT tags to both a) validate and b) work with browsers:
http://alistapart.com/articles/byebyeembed
(This is sort-of what I was aiming for with
USEEMBED. I assumed that you could just leave
EMBED out, but that will break on everything but IE, as the other browsers (a little churlishly) ingore the entire tag if it has MS's custom params in it.)
ObjectPlugin Global Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write
%<plugin>_<setting>%, for example,
%INTERWIKIPLUGIN_SHORTDESCRIPTION%
- One line description, shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Easily embed arbitrary media content (for Explorer. For Mozilla embed anything at all).
- Default parameters for plugin. These must be defined. (Some may still get overridden by browser plugins or settings inside the media itself)
- Set WIDTH = 320
- Set HEIGHT = 180
- Set CONTROLLER = TRUE
- Set PLAY = TRUE
- Set USEEMBED = TRUE
- Leave this set to TRUE. If FALSE content will only work in MSIE.
Plugin Installation Instructions
Note: You do need to have browser plugins installed to view embedded content. What and where they are is beyond the scope of this document. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.
- Download the ZIP file from the Plugin web (see below)
- Unzip
ObjectPlugin.zip in your twiki installation directory. Content: | File: | Description: |
data/TWiki/ObjectPlugin.txt | Plugin topic |
data/TWiki/ObjectPlugin.txt,v | Plugin topic repository |
lib/TWiki/Plugins/ObjectPlugin.pm | Plugin Perl module |
pub/TWiki/Plugins/ObjectPlugin/* | Some sample files |
- Configure the Plugin:
- TWiki 4.0 and up: Run the configure script to enable the Plugin
- Enable the Plugin settings as needed
- Alter the defaults if desired
- Test if the plugin is correctly installed:
- You should see something below:
%OBJECT{"http://support.microsoft.com/support/mediaplayer/wmptest/samples/new/mediaexample.wmv" height="240" width="320"}% %OBJECT{"http://twiki.org/p/pub/Plugins/ObjectPlugin/sample.mov" height="180" width="320"}%
%OBJECT{"http://twiki.org/p/pub/Plugins/ObjectPlugin/Sample.swf" height="180" width="320"}% %OBJECT{"http://twiki.org/p/pub/Plugins/ObjectPlugin/sample.html" arbitrary="plplpl"}%
Plugin Info
Note re Benchmarks: I modified the
PluginBenchmarkAddOn to use
curl -s instead of
geturl because it was already on my system. Benchmarking seems a little disused ...
Related Topics: TWikiPlugins,
EmbedPlugin,
EmbedQTPlugin,
EmbedFlashPlugin
Note re "TestedOnOs"
This plugin has been tested on a TWiki running on Mac OS X Tiger and Panther (10.3 and 10.4). The TWiki
output has been tested on Safari 1.3, 2.0; Firefox 1.5 (Mac and windows) and MSIE 6 Windows. As expected, only WMV, QT and flash work on IE.
--
TWiki:Main.PiersGoodhew - 16 Oct 2006
Just for reference I have this plugin working on 4.1.2 running under Ubuntu server 7.04 (Feisty Fawn). I had to make a small modification as detailed in my comment on
ObjectPluginDev but then it worked smoothly.
--
TWiki:Main.JasonJystad - 19 Nov 2007