You are here: STALklubben>TWiki Web>TWikiPlugins?>ObjectPlugin (2010-03-02, AdminUser)EditAttach

The Object Plugin

Embed Multi-Media Objects into TWiki topics (replaces EmbedPlugin?)

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 that recommended by the plugin providers). However, 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.

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 acceptable results (see Basic Usage below). These defaults can of course be overridden on a use-by-use basis.

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.

It also supports TWiki:Plugins.EmbedPlugin's EMBED syntax to enable it to superceed that plugin:

  • %EMBED{filename="string" width="number" height="number"}%

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.

HELP 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 automatically added
play text boolean whether to auto-play the content automatically added for QT and Flash
useembed text boolean whether to include a non-standard (but widely recommended) EMBED tag

Detection of media type/Recommended plugin syntax

The plugin detects most media types and uses a hybrid of the html markup recommended by the browser plugin makers - in the hope of providing maximum compatibility. This is done simply by checking the extension of the filename. Or, if the filename contains youtube.com it will automatically use flash

Originally, the plugin used (almost) the exact recommended HTML on a type-by-type basis, but I've abandoned this in favour of "one markup fits all" because you don't know which plugin will be handling what - the various ISO formats (MPEG1,2,4, MP3) will be taken by whatever plugin was installed last, and QuickTime? now handles Windows Media on Macintosh systems (at Microsoft's recommendation!).

While most of the HTML is as generic as possible, the CLASSID value and some other mime-type information is unique to a particular file-type, and for Flash, QuickTime? and Windows Media the Microsoft-sanctioned values are sent. I understand MSIE has to have this info or it totally burns ...

I haven't bothered with Real. If there's huge demand, it wouldn't be hard to add - but it may also be handled quite well by the generic media syntax already.

The sytax recommendations are found:

From those startpoints, basically everything gets merged: all synonymous parameters get sent (e.g. QT's "AutoPlay", Flash's "Play" and WMV's "AutoStart") together, set to the same value.

Then everything is smoodged onto one line, TWiki doesn't like html 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.

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.

defining additional file formats

The output of this plugin is paritally goverend by TWiki templates. the mov file output is defined in templates/objectplugin_mov.tmpl, which contains the classid's, codebase etc.
%TMPL:DEF{objectHeader_mov}%classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" %TMPL:END%
%TMPL:DEF{embedTag_mov}%TYPE="video/quicktime" PLUGINSPAGE="http://www.apple.com/quicktime/download/" %TMPL:END%
%TMPL:DEF{controlerHeight_mov}%16%TMPL:END%
To add other types add your own template using the same naming scheme (objectplugin_ext.tmpl).

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 = Embed Multi-Media Objects into TWiki topics (replaces EmbedPlugin?)

  • Default parameters for plugin. These must be defined. (For booleans use "TRUE" for true, anything else for false)
  • Set WIDTH = 320
  • Set HEIGHT = 180
  • Set CONTROLLER = TRUE
  • Set PLAY = TRUE
  • Set USEEMBED = TRUE

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server where TWiki is running.

Like many other TWiki extensions, this module is shipped with a fully automatic installer script written using the BuildContrib.

  • If you have TWiki 4.2 or later, you can install from the configure interface (Go to Plugins->Find More Extensions)
  • If you have any problems, then you can still install manually from the command-line:
    1. Download one of the .zip or .tgz archives
    2. Unpack the archive in the root directory of your TWiki installation.
    3. Run the installer script ( perl <module>_installer )
    4. Run configure and enable the module, if it is a plugin.
    5. Repeat for any missing dependencies.
  • If you are still having problems, then instead of running the installer script:
    1. Make sure that the file permissions allow the webserver user to access all files.
    2. Check in any installed files that have existing ,v files in your existing install (take care not to lock the files when you check in)
    3. Manually edit LocalSite.cfg to set any configuration variables.

Validation:

You should see something below:

wmv

%OBJECT{"http://support.microsoft.com/support/mediaplayer/wmptest/samples/new/mediaexample.wmv" height="240" width="320"}%

mov

%OBJECT{"http://stalklubben.org/foswiki/pub/TWiki/ObjectPlugin/sample.mov" height="180" width="320"}%

swf

%OBJECT{"http://stalklubben.org/foswiki/pub/TWiki/ObjectPlugin/Sample.swf" height="180" width="320"}%

you-tube

%OBJECT{"http://www.youtube.com/v/-dnL00TdmLY&hl=en&fs=1" width="425" height="344"}%

html

%OBJECT{"http://stalklubben.org/foswiki/pub/TWiki/ObjectPlugin/sample.html" arbitrary="plplpl"}%

Plugin Info

Plugin Authors: TWiki:Main.PiersGoodhew, TWiki:Main.SvenDowideit
Copyright: © 2006 TWiki:Main.PiersGoodhew, 2008 TWiki:Main.SvenDowideit
License: GPL (Gnu General Public License)
Plugin Version: 17674 (21 Oct 2008)
20 Oct 2008 modernise with TWiki:Plugins.BuildContrib, add EMBED Tag, remove WikiWord issues, templatise html output, add youtube supprt - TWiki:Main.SvenDowideit
16 Oct 2006 initial version
Change History:  
Dependencies: None
Plugin Home: http://twiki.org/cgi-bin/view/Plugins/ObjectPlugin
Feedback: http://twiki.org/cgi-bin/view/Plugins/ObjectPluginDev
Appraisal: http://twiki.org/cgi-bin/view/Plugins/ObjectPluginAppraisal

Related Topics: TWikiPlugins?, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences?

Topic attachments
I Attachment Action Size Date Who Comment
swfswf Sample.swf manage 1.8 K 2008-10-21 - 05:10 AdminUser Saved by install script
htmlhtml sample.html manage 0.1 K 2008-10-21 - 05:10 AdminUser Saved by install script
movmov sample.mov manage 21.2 K 2008-10-21 - 05:10 AdminUser Saved by install script
Topic revision: r2 - 2010-03-02 - 19:53:09 - AdminUser
 
This site is powered by FoswikiCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding STALklubben? Send feedback