MP3 Player Module

Return to the Module Documentation Index

The Idea

Users can listen to your MP3 collection while chatting. In this module, chatters may not upload their own MP3s, however. They have to listen to those which are already present on the server. Thus, this is essentially a way to share your MP3 collection with your users. The song list can be sorted, and the MP3 player automatically forwards to the next file in the list when the song is finished.

Setup

Locate the 'config.php' file within FlashChat's 'inc' folder. Open using a good text editor, like Textpad, and be very careful not to introduce PHP errors while editing. Be sure to backup your original config.php file, just in case you need to restore it.

Scroll down to the 'module' settings, and change the 'path' property to match the SWF path of the MP3 Player module. For example, like this:

	 'module' => array(
		'anchor'  => 0,
		'path'    => 'modules/mp3_player/mp3player.swf',
		'stretch' => true,
		'float_x' => 300, 
		'float_y' => 200, 
		'float_w' => 100, 
		'float_h' => 100, 
	 ),

I recommend setting 'anchor' to 0, and 'stretch' to true for this module, so that the viewable area of the MP3 player will stretch to accomodate the full space available to it. You can ignore float_x, float_y, float_w, and float_h for now. If you change 'anchor' to -1, then you may wish to adjust the float values.

The important thing is to ensure that 'path' is set correctly. If you put the module files in a folder other than "mp3_player", or if you recompiled the SWF using a different name, then obviously you'll have to adjust the 'path' value accordingly.

Configuration

This module is configured by editing two external XML files: config.xml and list.xml. You shouldn't be frighted by the presence of an XML file - it is simply a way to represent textual data in an organized manner.

Each <song> section of list.xml represents a song in your collection, and the "src" attribute should match the filename of the MP3 file in the "mp3" sub-folder.

	<song src="mp3/3.mp3">
<title>Guano Apes</title>
<artist>Open Your Eyes</artist>
<genre>Rock</genre>
<duration>3:52</duration>
</song>

<title>, <artist>, <genre>, and <duration> are fairly self-explanatory. The "src" attribute must lead to the MP3 file path, relative to the mp3player.swf file. Please note that MP3 files must be 64Kbps encoded.

You can re-order the songs by re-ordering them in the list.xml file, but you should bear in mind that this ordering will likely be over-rided anyway by users when they choose the "Sort by" option in the module interface.

Now, let's take a look at the options in config.xml....

<width> = The default module interface width. Setting 'stretch' = true in config.php overrides this setting.

<height> = The default module interface height. Setting 'stretch' = true in config.php overrides this setting.

<sort_by> = The default sort field. Options available include: title, artist, genre, or duration.

<sort_type> = The default sort type. Options available include: ASC or DESC

<sort_by_text> = The "Sort By" text.

<artist_text> = The "Artist" text.

<title_text> = The "Title" text.

<genre...> = The formatting of the Genre headers, when sorting by genre. In other words, when sorting by genre, the MP3 files are re-organized to appear in special, bold genre headers. You can specify the indentation and text style (bold, italic) using this XML tag.

<length_text> = The "Length" text.

Please remember to save your config.xml and banners.xml using UTF-8 format.