Google player works nicely to display audio clips in some browsers but doesn’t work on the iPad as it is driven by Flash. Alternatively you can display an audio clip in HTML 5 using the built in ‘audio controls’ but that won’t work in some of the older browser. The same problem occurs with flash animations.

In an attempt to solve this tricky dilemma I’ve written a quick Drupal module to display an audio clip player and animations in a variety of browsers. You can see the the result below. Let me know if you can see them okay!

displayaudioclip($audio)


displayanimation($clip)


If you are a Drupal user you can download the files here.

Install the module into your modules directory and activate it.

Displaying Audio Files

The audio files must be in mp3 format.

Create a folder called ‘audio’ in your root directory. (You can change this if you want by editing the $path= line in the sniffer.module file) Upload your audio clip in mp3 format into the audio folder.

Create a new blog entry. Set the input format to PHP code. Write your blog entry as usual.

In the place where you want the audio clip to appear add the following code.

<?php displayaudioclip(‘audio.mp3’) ?>

Displaying Animations

Create your animation in Flash and save it as a .swf file. You need to save it as SWF 8 and ActionScript 2.0 as later versions don’t convert so well.

Upload the file to the Google Swiffy website. This tool will convert the animation to HTML format for you. You can save the converted file at the bottom of the page.”

You should now have two animation files. animation.swf and animation.html Upload them both to folder ‘swiffy’ in your site’s root. You can rename this folder by editing the ‘$path=’ line in the .module file if you prefer.

Create a new blog entry. Set the input format to PHP code. Write your blog entry as usual.

In the place where you want the animation clip to appear add the following code.

<?php displayanimation(‘animation’) ?>

Notice that there is no .swf or .html after the file name.
When you view the page you should see the animation displayed either as a Flash file or as an HTML file depending on which browser you use to view it.

If you don’t use Drupal you will probably still find the sniffer module. Download the file. Open the file sniffer.module in your favourite text editor and you’ll find a couple of PHP functions. displayaudioclip($audio) and displayanimation($clip) which you can use on your site with a little bit of PHP knowledge.