Extension:MP3MediaHandler
MP3MediaHandler Release status: beta |
|
---|---|
Implementation | Media |
Description | Adds a media player for mp3 files on the wiki. |
Author(s) | Mark Clements (HappyDogtalk) |
Latest version | 1.0.0 (2016-02-11) |
MediaWiki | 1.23+ |
PHP | 5.3+ |
Database changes | No |
License | No license specified |
Download | |
Quarterly downloads | 32 (Ranked 104th) |
Translate the MP3MediaHandler extension if it is available at translatewiki.net | |
The MP3MediaHandler extension allows any .mp3 files that have been uploaded to be playable via an in-browser audio player. It uses the HTML5 <audio>
tag if supported, with a fallback to a direct file link (which the browser will either play natively, open in a local media player or prompt the user to download).
In addition, it is possible to install a Flash-based media-player as an alternative fallback, so if the browser supports Flash, but not the <audio>
tag, then it will use this before falling-back to the native browser behaviour.
Requirements
editThere are no essential requirements, but if you want to offer Flash as a fallback then you will need to download an appropriate Flash media player. Some examples are given below but any Flash player that supports mp3 playback may be used.
Installation
edit- Make sure that the required software is installed before you continue!
- Download and move the extracted
MP3MediaHandler
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MP3MediaHandler - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'MP3MediaHandler' );
- Configure as required. (see also the examples provided)
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Configuration
editVariable name | Default value | Description |
---|---|---|
$wgFlashPlayerPath | (not set) | The URL (absolute, or relative to the wiki entry-point) of the .SWF file for the Flash player. If not set, then no Flash-based fallback is provided. |
Flash Configuration (Only relevant if $wgFlashPlayerPath is set.)
| ||
$wgFlashPlayerURLParam | "url"
|
The name of the parameter that will be used to pass the media-file URL to the SWF. |
$wgFlashPlayerParams | array()
|
An array of key => value pairs of additional Flash configuration parameters. These will be added as <param> tags.
|
$wgFlashPlayerFlashVars | array()
|
An array of key => value pairs of additional parameters that you need to pass to the SWF file. These will be output in the FlashVars <param> tag, along with the URL parameter defined above (so do not include that parameter in this array).
|
$wgFlashPlayerWidth | (not set) | These two variables may be set to control the width/height of the Flash player. If either is omitted then no value will be set, so the default Flash movie size will be used. |
$wgFlashPlayerHeight |
Usage
editJust make a wikilink to the MP3 file e.g. [[File:12ToccataAndFugueInDMinor_vbr.mp3]].
Specific Flash players
editThis section holds example configurations for popular Flash players that support mp3 files. Please add your own example configuration for any popular players not on this list.
Note that you only need to install/configure a fall-back Flash player if you need to support older browsers that haven't implemented the <audio>
tag for .mp3 files.
All examples assume the SWF file is placed in your root wiki folder. If it is located elsewhere then you will need to update $wgFlashPlayerPath
appropriately.
Mini MP3 Player
edit- Website: http://flash-mp3-player.net/players/mini/
- Direct SWF Link: http://flash-mp3-player.net/medias/player_mp3_mini.swf
$wgFlashPlayerPath = "player_mp3_mini.swf";
$wgFlashPlayerURLParam = "mp3";
$wgFlashPlayerParams = array(
'bgcolor' => "#5a5757",
);
$wgFlashPlayerHeight = "20";