iaian7 » code » txp   John Einselen, 8.01.07 (updated 10.04.11)    

an7_audio is a simple Textpattern plugin for using Jeroen Wijering’s Flash MP3 Player. There are two tags for using either <embed> or <script> enclosures. The plugin loads one file per player, though the flash player will also support XML playlists.

<txp:an7_audio audio="audiofile.mp3" />

<txp:an7_audio audio="audiofile.mp3" width="480" digits="false" />

Only the audio=”“ variable is required, but you have control over other settings such as colours, playback options, default volume, size, and DIV class. I’ve also included an html file link prepended to the flash player. This may not be terribly useful outside of an easy download link, save for when using the plugin with Feedburner to create a podcast (my primary goal for this project).

Firefox 2.0 in OS X is often incapable of properly rendering flash movies on top of other content (such as a background image). I’ve tried all sorts of fixes, with no working solutions. Firefox also ignores flash variables such as colour styles or digit settings, and individual players may take on the variables of those before them, after them, or not at all. I honestly suggest using Safari on the mac, and if you’re running Windows Firefox, it should at least display something (though styling issues still run rampant).


This is best done using the Feedburner service. It’s easy, free, and best of all, will translate a simple blog section into an iTunes compatible feed. You’ll need to follow the directions on the site for setting up your podcast, and keep the following in mind…

Feedburner will create a media enclosure for the first file link it comes across in each post. It can only read what’s posted in the Textpattern feed (either RSS or Atom), so if you’re syndicating excerpts instead of the body, you have to include the link there. an7_audio has a “Feedburner link and download button” function that makes it easy to prepend an html link to the flash player script.

Only the first paragraph will be used in the iTunes discription. If the flash player is the first part of the post, iTunes won’t see any plain text to use, and the discription will be blank. However, this can be fixed by using Feedburner’s Summary Burner. It will automatically take the first paragraph of actual body text in the post and truncate it to a nice iTunes length (along with a nice line saying “… visit my website for more” or something).

tag options

audio="audiofile.mp3" — the only required setting, this is the audio file url (including any needed subdirectories within your root audio folder)

autostart="false" — sets autoplay option to start the music on page load, or wait for the user to press the play button. default is “false”

repeat="false" — sets repeat on or off. default is “false”

back="0xFFFFFF" — background colour for the flash player, in hexadecimal. default is white

front="0x000000" — foreground colour for the flash player, in hexadecimal. default is black

light="0x000000" — highlight colour for the flash player, default is black

digits="true" — shows or hides numerical time display, default is “true”. time passed and time remaining are placed on either end of the progress bar

volume="80" — sets the starting volume for the file. default is “80”

width="300" — default width for the flash player, in pixels. default is “300”

height="19" — height of the flash player, in pixels. player is 20 pixels high, but default is “19” to remove the 1 pixel shadow

class="an7_audio" — sets the class for the DIV container. default is “an7_audio”


1 (version 0.3.5)
1 (zipped image file)
Flash MP3 Player (external page)


Installation of the Textpattern plugin merely requires the copying and pasting of the text file into the “Install Plugin” box in your Admin panel (Admin > Plugins).

To set up the flash player, follow the installation notes from the official site. Personally, I’ve always kept a js/ folder in my root directory, but you can do it differently. Just make sure any changes are properly updated in the plugin, and link the script files in your Textpattern page headers. For clean URL setups, you will need to use a prepended slash when defining your folders (”/audio”) whereas messy URLs won’t need it.

Remember to customize the download button section of the plugin code (keeping in mind there are two tags, one for embeded and one for scripted). The 1 listed above is one option, and fits nicely with the default installation of the flash player.

version history

Please help improve this plugin by reporting errors, issues, or comments via email

— corrected an error in the help file
— first publicized version
— finished support for both <embed> and <script>
— beta release
— fixed many of the coding errors
— alpha release

help and support

Full descriptions and tag options are listed in the Help file within the plugin.

My plugins are designed for specific issues and solutions in my own work (and my own file management styles), so I can’t promise they’ll work just as wonderfully for you.

For questions and support, please visit the post in the Textpattern Forums.


this project was inspired by the excellent plugin JNM_audio, and was helped along by tutorials from thresholdstate.com.

Jim Mirkalami, 7.02.08

I have been visiting this site for a long time, so i decided to show you my appreciation by making a comment.

Jim Mirkalami