This recipe allows to easily add multimedia content into your wiki pages with the help of flash media players.
(:neo_mp3-player Attach:boum.mp3 +link:)
Once installed, the recipe provide the following markup to manage your multimedia data:
(:PLAYER_TYPE-player MEDIA_DATA OPTIONS:)
- identifies the flash player used to handle the multimedia data. The recipe is able to handle several flash players concurrently. See sections below for further details and sample types.
- is the multimedia content to render by itself, specified as a usual link target.
- This could be either:
- The link target specification is handled by the Linked Resource Extras recipe. See there for syntaxic details and usage options.
- are all the extra parameters you may provide to the media player.
- The recipe internally handles the following extra options (they are not forwarded to the media player):
[-/+]link, to provide or not a direct link to the media before or after the flash player itself.
[-/+]feed, to declare or not the media as an extra enclosure for the current page.
text="SOME_TEXT", to provide an alternate text for the media name or link.
objbgcolor, to control the general aspect and layout of the flash object.
- The options array will have a number of substitutions made for convenience
- Syntax "Attach:" will give you the direct attachment URL (useful for initial images, eg on a flash player)
- $url will be substituted for the actual media URL (useful for initial images which are a variation of the media url)
- $txt will be substituted for the link text (might be helpful...)
(:my_mp3-player Attach:my_song.mp3 text="My song" +link:) (:some_flv-player (Attach:HolidaysVideos./)LastWeekEnd(.flv) -link:)
- Install the Linked Resource Extras required scripts as described on their own recipe page.
- Fetch a flash media player distribution archive and extract it into your
/pubto get a
/pub/FLASH_MEDIA_PLAYER_DIRdirectory tree available (see below for known-working ones).
- Put the flashmediaplayer.phpΔ script in your
/cookbookdirectory. For PHP 5.5 and newer please use flashmediaplayer72.phpΔ instead.
- Provide a related configuration definition and include the script in your local customization files:
$FlashMediaPlayerInfo['PLAYER_TYPE'] = array( 'swf' => "FLASH_MEDIA_PLAYER_DIR/player.swf", 'objparms' => array( 'flashvars' => array("MEDIA_URL=\$url", # see notes "MEDIA_TXT=\$txt", # below "\$parms")), # 'defaults' => array('align' => 'middle', 'width' => 200, 'height' => 20)); include_once('cookbook/flashmediaplayer.php');
- Configuration notes
- The PLAYER_TYPE will be the identifier used by the markup to select the desired player and it's associated configuration data array. Therefore, the
(:jw_mp3-player:)markups are respectively related to '
mp3' and '
jw_mp3' configuration data.
- The 'swf' value locates the flash player itself (as a
- The 'flashvars' refers to an array of media player specific parameters provided to the inner flash object as a sole url encoded query string.
- The 'defaults' array allows to define defaults values for all the player parameters.
- You may also use the +diag option (either as a default or a markup parameter) to reveal the generated html code (useful when setting up a player config).
- During the code generation, the special
$parmstokens are replaced respectively with the PmWiki variable value, the target media url, it's displayed name (computed from the markup specification or given by the
text=...option) and the other markup parameters.
- Limitations/Known bugs
- The encoding scheme of the flash parameters variable prevent the use of "pmwiki-driven" attachment downloads, ie. the core configuration variable
must be set to
- The enclosure handling implementation is very rough.
The player(s) object(s) are enclosed into
<span class='flashmediaplayer'>...</span> sections. This setting may be altered using the
$FlashMediaPlayerInfo['#block'] configuration parameter.
"Known-to-work" flash media players
The following flash media players have been made run succesfully during the recipe development (even if all their features or variants haven't been tested). Please refer to their respective site for all specific features and parameters.
# XSPF song mode $FlashMediaPlayerInfo['xspf_slim'] = array( 'swf' => "xspf/xspf_player_slim.swf", 'objparms' => array( 'flashvars' => array("song_url=\$url", "song_title=\$txt", "\$parms")), 'defaults' => array('align' => 'middle', 'width' => 400, 'height' => 15));
- http://resources.neolao.com/flash/components/player_mp3, http://resources.neolao.com/flash/components/player_flv
- Creative Commons BY SA.
- player_mp3.swf, player_flv.swf
$FlashMediaPlayerInfo['neo_mp3'] = array( 'swf' => "neolao/player_mp3.swf", 'objparms' => array( 'flashvars' => array('mp3=$url', '$parms')), 'defaults' => array('align' => 'middle', 'width' => 200, 'height' => 20));
$FlashMediaPlayerInfo['neo_flv'] = array( 'swf' => "neolao/player_flv.swf", 'objparms' => array( 'flashvars' => array('flv=$url', '$parms')), 'defaults' => array('align' => 'top', 'width' => 320, 'height' => 240));
Example using Flashvars:
- http://www.alsacreations.fr/?dewplayer, dewplayer-1-5
- Creative Commons BY ND.
$FlashMediaPlayerInfo['dew'] = array( 'swf' => "dewplayer/dewplayer.swf", 'objparms' => array( 'flashvars' => array("mp3=\$url", "\$parms")), 'defaults' => array('align' => 'middle', 'width' => 200, 'height' => 20));
Longtail (formerly Jeroen Wijering aka JW FLV Player) (mp3/flv)
- Creative Commons BY NC SA. (Commercial 15EU)
$FlashMediaPlayerInfo['longtail'] = array( 'swf' => "longtail/player.swf", 'objparms' => array( 'flashvars' => array("file=\$url", "\$parms")), 'defaults' => array('align' => 'middle', 'width' => 600, 'height' => 480));
- Linked Resource Extras
- http://www.okaytoplay.com/wiki/Flash_Based_Podcast_Players for some more flash media players.Luigi
- Fixed fullscreen ability, added some option parsing and substitution, eg 'Attach:' '$url' and '$txt'. Beware: Moved $link inside span
&lines 112 and 115 in order to produce valid HTML (Petko)
- Taken account of
$FarmPubDirUrl. Added handling of +diag option.
- Fixed internal configuration handling bugs.
- Enclosed resulting
- Synched with Linked Resource Extras.
- Synched with Linked Resource Extras.
- Added experimental "forced download" mode for the media extra link, and RSS enclosure feed handling.
- Initial release.
See discussion at FlashMediaPlayer-Talk