shortcut to content

Flash Audio & Video

Page address: http://www.mnsu.edu/its/web/template/documentation/flashobjects.html

Using the Flash mp3 player

Below is a sample of the mp3 player. When the play button is clicked the player will start to download and play an mp3.

[MP3] Sample mp3 (25.29 MiB)

For accessibility reasons, a direct link to the mp3 files should also be provided alongside the Flash-embedded mp3. This is to allow the listeners a convenient way to download the mp3 file and listen to it using a playback device of their choice.

Instructions for embedding the player into a page

In order to add an mp3 player to a page the code below needs to be inserted with a few changes. The portions that are in bold need to be changed to point to the proper locations of the files.

  • The first parameter in the function call needs to contain the title of the mp3. In the above example, the mp3 title is Sample mp3.
  • The second parameter is the path to the mp3.
  • The third parameter is the path to the mp3-player.swf file

Any code that is not in bold should not be edited in the following code.

<?php
function insert_mp3_player($title, $mp3, $swf) {
$flinkString = $title . '[' . $mp3 . ']';
echo <<<END
<object type="application/x-shockwave-flash" data="$swf" width="251" height="21">
<param name="movie" value="$swf"/>
<param name="FlashVars" value="mp3URL=$mp3"/>
</object>
END;
echo "<p>";
filelink($flinkString);
echo "</p>";
}
insert_mp3_player('mp3 title', '/path/to/your.mp3','/path/to/mp3-player.swf');
?>

Download the mp3 player

[ZIP] Flash mp3 player (9 KiB)