FlashMediaPlayer
Description
This recipe allows to easily add multimedia content into your wiki pages with the help of flash media players.
Notes
Usage
(: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:)
where:
- PLAYER_TYPE
- 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.
- MEDIA_DATA
- 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.
- 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.align
,width
,height
,quality
,wmode
,menu
,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...)
Resulting samples:
(:my_mp3-player Attach:my_song.mp3 text="My song" +link:) (:some_flv-player (Attach:HolidaysVideos./)LastWeekEnd(.flv) -link:)
Installation
- 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
/pub
to get a/pub/FLASH_MEDIA_PLAYER_DIR
directory tree available (see below for known-working ones). - Put the flashmediaplayer.phpΔ script in your
/cookbook
directory. 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
(:mp3-player ...:)
and(:jw_mp3-player:)
markups are respectively related to 'mp3
' and 'jw_mp3
' configuration data. - The 'swf' value locates the flash player itself (as a
relative path).$FarmPubDirUrl
- 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
,$FarmPubDirUrl
$url
,$txt
and$parms
tokens are replaced respectively with the PmWiki variable value, the target media url, it's displayed name (computed from the markup specification or given by thetext=...
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$EnableDirectDownload
1
. - The enclosure handling implementation is very rough.
Styling hints
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 (mp3)
- Home
- http://musicplayer.sourceforge.net/
- License
- BSD
- Download
- http://downloads.sourceforge.net/musicplayer/xspf_player-0.2.3.zip
- Configuration
-
# 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));
Neolao (mp3/flv)
- Home
- http://resources.neolao.com/flash/components/player_mp3, http://resources.neolao.com/flash/components/player_flv
- License
- Creative Commons BY SA.
- Download
- player_mp3.swf, player_flv.swf
- Configuration
-
$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:
Dewplayer (mp3)
- Home
- http://www.alsacreations.fr/?dewplayer, dewplayer-1-5
- License
- Creative Commons BY ND.
- Download
- dewplayer.swf
- Configuration
-
$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)
- Home
- http://www.longtailvideo.com/players/jw-flv-player//
- License
- Creative Commons BY NC SA. (Commercial 15EU)
- Download
- http://www.longtailvideo.com/players/jw-flv-player/
- Configuration
-
$FlashMediaPlayerInfo['longtail'] = array( 'swf' => "longtail/player.swf", 'objparms' => array( 'flashvars' => array("file=\$url", "\$parms")), 'defaults' => array('align' => 'middle', 'width' => 600, 'height' => 480));
Contributors
See Also
- Linked Resource Extras
- http://www.okaytoplay.com/wiki/Flash_Based_Podcast_Players for some more flash media players.Luigi
Release Notes
- 2008-02-11
- Fixed fullscreen ability, added some option parsing and substitution, eg 'Attach:' '$url' and '$txt'. Beware: Moved $link inside span
- 2008-01-31
- Changed
&
to&
lines 112 and 115 in order to produce valid HTML (Petko) - 2008-01-04
- Taken account of
$FarmPubDirUrl
. Added handling of +diag option. - 2007-05-03
- Fixed internal configuration handling bugs.
- 2007-04-30
- Enclosed resulting
<object>
into a<span>
block. - 2007-02-15
- Synched with Linked Resource Extras.
- 2007-01-25
- Synched with Linked Resource Extras.
- 2007-01-22
- Added experimental "forced download" mode for the media extra link, and RSS enclosure feed handling.
- 2007-01-02
- Initial release.
Comments
See discussion at FlashMediaPlayer-Talk
User notes +2: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.