Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

FlashMediaPlayer

Summary: Embed flash media players in your pages
Version: 2008-01-04
Status: Beta
Prerequisites: Linked Resource Extras recipe and a flash media player (see below for some references).
Maintainer: Dfaure
Categories: Media [Update Me]

Description

This recipe allows to easily add multimedia content into your wiki pages with the help of flash media players.

Notes

Usage

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:
  • an Uploaded attachement: Attach:an_attached_video.flv,
  • an Intermap? link: InterMap:something/somewhere/else.doc,
  • or a fully qualified external link: http://host/my/external/resource.dat.
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.

Resulting samples:

(:my_mp3-player Attach:my_song.mp3 text="My song" +link:)

(:some_flv-player (Attach:HolidaysVideos./)LastWeekEnd(.flv) -link:)

Installation

  1. Install the Linked Resource Extras required scripts as described on their own recipe page.
  2. 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).
  3. Put the flashmediaplayer.phpΔ script in your /cookbook directory.
  4. 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 $FarmPubDirUrl relative path).
  • 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 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 $EnableDirectDownload must be set to 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));

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));

Jeroen Wijering (mp3/flv)

Home
http://www.jeroenwijering.com/
License
Creative Commons BY NC SA. (Commercial 15EU)
Download
flash_mp3_player.zip, flash_flv_player.zip
Configuration
$FlashMediaPlayerInfo['jw_mp3'] = array(
  'swf' => "jeroenwijering/mp3player.swf",
  'objparms' => array(
    'flashvars' => array("file=\$url",
                         "\$parms")),
  'defaults' => array('align' => 'middle',
                      'width' => 200,
                      'height' => 20));
$FlashMediaPlayerInfo['jw_flv'] = array(
  'swf' => "jeroenwijering/flvplayer.swf",
  'objparms' => array(
    'flashvars' => array("file=\$url",
                         "\$parms")),
  'defaults' => array('align' => 'middle',
                      'width' => 200,
                      'height' => 20));

Contributors

Dfaure

See Also

Release Notes

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

Now I'm using flash from html pages (http://dodin.valerie.free.fr/valerie.html) but I plan to convert these sites to PmWiki to make them editable by the artists themselves. Is it possible to have playlists with flv? (several videos in sequence). I can change reader if necessary - thanks jdd


I am using FlashMediaPlayer with Jeroen Wijering's flash player. Unfortunately, when trying to insert several flash-player markups on the same page, the windows are not clearly positioned on a new line, even if I use \\ or \\\ to separate the markup. Instead, the flash windows overlap in an ugly fashion. Must be either a problem in FlashMediaPlayer or LinkedResourceExtras. JK

Issue solved in last version --Dfaure April 30, 2007, at 08:44 AM

I'm new to PMwiki and to me it looks as if I did everything as described: I downloaded the extlinkedres.zip, put the extlinkedres.php in the cookbook, the extlinkedres.js in the /pub directory, downloaded and put the "xspf_player_slim.as", the "xspf_player_slim.fla" and the "xspf_player_slim.swf" in /pub/FLASH_MEDIA_PLAYER. Then I wrote the above configuration parameter for the XSPF media player in the config.php. and inluded both extlinkedres.php and flashmediaplayer.php to the config.php. I even set $EnableDirectDownload to 1 in the config.php. Finally I wrote in a wiki page (:mp3 Attach:my_song.mp3 Δ text="My song" +link:) -even tried it with the mp3's that are uploaded on my wiki ;) but it just showed me the markup on the rendered page and no flash-player. Did I forgot something? Excuse my beginnerish questions, but I couldn't find a solution even not in the mailing lists. Thanks a lot -- Torsten May 01, 2007, at 06:52 PM

Uppercased term were placeholders subject to configuration. Making the assumption that you followed the sample proposed above:

  • The player data should be put into /pub/xspf (cf. 'swf' => "xspf/xspf_player_slim.swf" line).
  • The configuration data being held by $FlashMediaPlayerInfo['xspf_slim'], the markup to use is: (:xspf_slim-player Attach:my_song.mp3 text="My song" +link:)

Hope this makes things a bit clearer ;) --Dfaure May 02, 2007, at 01:50 AM

Oh I see. Thanks for the advise. Dfaure. It works a bit more now but not yet really. What I get now on the wikipage is a link to my_song.mp3 that starts downloading this .mp3 when I click on it. In the URL it says: action=mediadownload&upname=my_song.mp3 So can you tell me what else it is I have to do to make it played by the flashplayer? -- cheers -- Torsten May 02, 2007, at 05:01 AM

So sorry. It works. The xspf-directory was misspelled. Thanks a lot. ;) -- Torsten May 02, 2007, at 05:09 AM

The strange thing is that these players work in Firefox but not in IE (at least on my PC). For example, Dewplayer says "no mp3 file" in IE.. whereas it finds and plays the mp3 file in Firefox without problems. Is there any way to fix this? -- Gunnar, Jun 22, at 02:35 AM.

You may first make sure that you're meeting all the recipe requirements (Linked Resource Extras sub-recipe php and javascript components installed, $EnableDirectDownload configuration parameter properly initialized). Lastly, with the $EnableObjectAutoActivation parameter set to 0 you may disable all the javascript wrapping code specific to IE. --Dfaure June 22, 2007, at 02:29 AM

Hey.I'm trying to get this this to work with Lacy Morrows XSPF Jukebox, but I dont, because I really suck at this. It's a quite neat webplayer, with automatic playlist support and stuff, so I figured I'd give it a shot because it'll save me time later.

The deal with it is that you can have all the variables in a file (variabels.txt), and the only thing you have to do when embeding it is to give location of the file. Then it will use another script to create the playlist out of a given folder.

You can find the (quite messy) documentation here: http://lacymorrow.com/projects/jukebox/xspfdoc.html. I hope it can be solved easily. Great recipe btw, thanks!

Edit - History - Print - Recent Changes - Search
Page last modified on January 04, 2008, at 07:55 AM