Extension:FlashMP3

FlashMP3 embeds a simple Flash-player for playback of mp3-files. It is based on the great Audio Player Wordpress plugin by 1pixelout. It can handle multiple local and/or remote files in one player and multiple players on each site. The appearance of the player is highly customizable.

It is also possible to use the nice last.fm player with the files hosted there. It works on a label, artist, album or song-level.

For problems and suggestions please use the discussion page of this article.

License
Copyright © 2007 Matthias Korn This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Base Syntax
filename.mp3 can be the name of a file uploaded to the Wiki or an external URL. Additional parameters are optional.

Multiple files
Multiple files can be played in one FlashMP3 player one after the other by separating them with comma.

Multiple players
Multiple FlashMP3 players on one site can be achieved by giving them an id.

secondmp3.mp3

Examples
mymp3.mp3

Plays an uploaded mp3-file called mymp3.mp3.

http://www.somedomain.com/mp3/mymp3.mp3

Plays the remote mp3-file from the URL http://www.somedomain.com/mp3/mymp3.mp3.

mymp3.mp3,yourmp3.mp3|autostart=yes|loop=yes

Plays the two uploaded files mymp3.mp3 and yourmp3.mp3 one after the other, autostarts playing when the site is loaded and loops the files.

Base Syntax
resourceID and resourceType have to be retrieved from the source of the last.fm page of which you want to embed the player (Right Click -> View Page Source and search for resourceID and resourceType). Both resourceID and resourceType are compulsory. Additional parameters are optional.

resourceType is either artist, album, song, label, playlist or the ID-number directly (if you know it).

Parameter Reference
Additional parameter are possible as long as the last.fm player can interpret them in the given situation (i.e. resourceType).

Examples
11572702|artist

Plays songs from the given artist (Tookoo).

51022335|song|firstTrackName=Dance+For+Yourself|firstArtistName=TOOKOO|albumArt=http://static.last.fm/coverart/130x130/3245162.jpg|restDuration=227

Plays the given song and displays the track name, artist name and duration as well as the cover right after loading.

Code
You can change the Default Title ($restTitle) and the Default Album Cover ($albumArt) in line 87 and line 91 respectively to your needs (for last.fm player only).

Installation
1. Copy & paste the code above in a file called flashmp3.php and place it in your extensions directory of your MediaWiki folder.

2. Download the Audio Player plugin from 1pixelout. From the zip-archive copy the files audio-player.js and player.swf in a new folder called audio_player in your extensions directory.

3. Put this line near the end of your LocalSettings.php in the MediaWiki root folder to include the extension.

Uploading mp3-files
To be able to upload mp3-files to your MediaWiki also do the following steps.

4. Allow uploading of mp3-files by adding this line near the end of your LocalSettings.php.

5. Set the maximum size for file uploads in your php.ini.

6. Set the maximum size for file uploads by adding this line to your LocalSettings.php.

Limitations

 * The default player has a white background at the beginning when still folded. This is a limitation of the 1pixelout player and can not be changed. (Firefox on Linux only!?)
 * For the last.fm player you have to search the source code to find the resourceID. To my knowledge there is no better way to do this at the moment.

Changelog

 * v0.91 (2007-04-03)
 * fixed some possible Cross-site scripting vulnerabilities


 * v0.9 (2007-03-04)
 * added last.fm player


 * v0.8 (2007-02-25)
 * initial release