There actually is an error when running this plugin with GS3;
the error i get when in debug mode is on line 45:
Code:
$bgColor = implode("",@file(GSDATAOTHERPATH. '/mp3playerextended.cfg'));
i guess it can't write the config file for some reason; but this doesn't stop the plugin from working.
I made a modification to the plugin which prevents more than 1 player from playing at the same time on a page;
to get this functionality, here are the steps:
1.) add ascending ID to the player code:
in mp3-pluginextended.php, change the function playerAdd (line 62) to this:
Code:
function playerAdd($targetFile,$bgColor){
global $SITEURL, $ap_playerID;
$site = $SITEURL;
// Get next player ID
$ap_playerID++;
if (file_exists(GSDATAUPLOADPATH.'audio/'."$targetFile")) {
$targetFile = $site."data/uploads/audio/$targetFile";
}
$player = "<object type='application/x-shockwave-flash' data='".$site."player.swf'";
$player .= " width='310' height='24' id='audioplayer".$ap_playerID."'><param name='movie' value='".$site."player.swf' />";
$player .= "<param name='FlashVars'value='playerID=".$ap_playerID."&bg=0xf8f8f8&leftbg=0xeeeeee&lefticon=0x666666&rightbg=0xcccccc&";
$player .= "rightbghover=0x999999&righticon=0x666666&righticonhover=0xffffff&text=0x666666&slider=0x666666&";
$player .="track=0xFFFFFF&border=0x666666&";
$player .="loader=0x9FFFB8&soundFile=$targetFile' /><param name='quality' value='high' /><param name='menu' value='true' />";
$player .="<param name='bgcolor' value='$bgColor' /><param name='wmode' value='opaque' /></object>";
return $player;
}
** also note that the above code has the MP3 files in a subdirectory of the uploads folder, called "audio".
2.)
Replace the player.swf with a different one that can be controlled by the javascript function (attached to this post)
3.)
Place this javascript file somewhere on your site and call the script in your header (prevents 2 players from playing at the same time); usually called audio-player.js
Code:
var ap_instances = new Array();
function ap_stopAll(playerID) {
for(var i = 0;i<ap_instances.length;i++) {
try {
if(ap_instances[i] != playerID) document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 1);
else document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 0);
} catch( errorObject ) {
// stop any errors
}
}
}
function ap_registerPlayers() {
var objectID;
var objectTags = document.getElementsByTagName("object");
for(var i=0;i<objectTags.length;i++) {
objectID = objectTags[i].id;
if(objectID.indexOf("audioplayer") == 0) {
ap_instances[i] = objectID.substring(11, objectID.length);
}
}
}
var ap_clearID = setInterval( ap_registerPlayers, 100 );
it would be cool to make a new version of the plugin where all of these things are included; I would do it but i'm not sure how to have the plugin itself add the script to the header; maybe one of the original authors can take this info and make the next version...mp3 player ultimate...
-marc