From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg

Release status:Extension status beta

ImplementationTemplate:Extension#type Media
DescriptionTemplate:Extension#description Adds a media player for mp3 files on the wiki.
Author(s)Template:Extension#username Mark Clements (HappyDogtalk)
Latest versionTemplate:Extension#version 1.0.0 (2016-02-11)
MediaWikiTemplate:Extension#mediawiki 1.23+
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license No license specified

Translate the MP3MediaHandler extension if it is available at translatewiki.net

Check usage and version matrix.

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.


There 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.


  • Download and place the file(s) in a directory called MP3MediaHandler in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/MP3MediaHandler/MP3MediaHandler.php";
  • Configure if required.
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


Variable 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.


Just make a wikilink to the MP3 file e.g. [[File:12ToccataAndFugueInDMinor_vbr.mp3]].

Specific Flash players[edit]

This 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]

$wgFlashPlayerPath = "player_mp3_mini.swf";
$wgFlashPlayerURLParam = "mp3";
$wgFlashPlayerParams = array(
        'bgcolor' => "#5a5757",
$wgFlashPlayerHeight = "20";