Wiki source for Mp3Player


Show raw source

====Simple MP3 Player====

I'm interested in providing some "audio" links on my pages both for some variety (in recognition of different learning styles), but also so that a few basic introductions can be done in audio so that visually impaired people can listen to descriptions of some features. [**Note:** I recognize that it would be useful if the flash had a floating tooltips sort of feature, like images, but I don't know how to do that. Feel free to add it to the code below if you know how to add "alt" equivalency to flash.].
~&Maybe use this player instead, which uses html for the gui : http://www.kyberfabrikken.dk/opensource/playa/

add the following code to your ##actions## directory as ##audio.php##.
%%(php)
<?php
// audio.php was developed by GmBowen for a SSHRC research project from code provided to enact a swf file for playing audio
// which is posted at http://hotpot.uvic.ca/howto/audio.htm. The swf file is available from
// http://hotpot.uvic.ca/howto/hbs_mp3_player.swf
// USE: {{audio url="http://..." [title="title"]}} Title is optional, a url must be provided.
//
// the "-16" below is based on there being 16 characters in the suffix after the wikki root
// for example "wikiroot/wakka.php?wakka=" has 16 characters in "wakka.php?wakka="...if your site setup differs you must
// change the "-16" to whatever the character count is.

$site_base = $this->GetConfigValue("base_url");
$site_base = substr($site_base,0,-16);
$site_base = $site_base."flashtools/";
$player = $site_base."hbs_mp3_player.swf";

if (!($url)) {echo "<strong>You must provide the url, including http://, as an audio file source. </strong>"; return;
}else{
echo $title." ";
}
if ($player)
echo '<object data="hbs_mp3_player.swf" width="24" height="17" style="vertical-align: bottom;" type="application/x-shockwave-flash">
<param name="type" value="application/x-shockwave-flash" />
<param name="src" value="'.$player.'" />
<param name="data" value="'.$player.'" />
<param name="codebase" value="'.$player.'" />
<param name="FlashVars" value="TheSound='.$url.'" />
<param name="movie" value="'.$player.'" />
<param name="loop" value="false" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<a href="'.$url.'">"'.$url.'"</a>
</object>';
// add the following line after the FlashVars line if you want to restrict urls to the server the flash file is found on
// <param name="allowScriptAccess" value="sameDomain" />
// in that case, relative urls are usable.
?>
%%

You also need the SWF file, called hbs_mp3_player.swf which is available [[http://hotpot.uvic.ca/howto/hbs_mp3_player.swf | here]]. This site also provides the fla file in this [[http://hotpot.uvic.ca/howto/audio.htm | tutorial]] to allow further modification (I'm quite primitive in flash, so no hope of me doing any). I've installed this file in a directory called ##flashtools## which is in my wiki root.

Using this code, if you typed in...
""{{audio url="http://hotpot.uvic.ca/howto/narrative1.mp3" title="Test Sound"}}""
you'd see.....
http://gmbowen.educ.unb.ca/wikitest/audioimg.jpg
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki