Override to use the Slim player
In the template.php file I put this code which overrides the theme_audio_mp3_player function to use the 'Slim' player:
<?php
function phptemplate_audio_mp3_player($node, $options = array()) {
global $base_url;
// flash only supports a limited range of sample rates.
switch ($node->audio_fileinfo['sample_rate']) {
case '44100': case '22050': case '11025':
break;
default:
return;
}
$options = array_merge((array) $options, array(
'song_url' => $node->url_play,
'song_title' => $node->audio_tags['title'],
));
$params = array();
foreach ($options as $key => $val) {
$params[] = rawurlencode($key) .'='. rawurlencode($val);
}
$url = $base_url .'/'. drupal_get_path('module', 'audio') .'/players/xspf_player_slim.swf';
if ($params) {
$url .= '?'. implode('&', $params);
}
$output = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="400" height="15" id="xspf_player" align="middle">';
$output .= '<param name="allowScriptAccess" value="sameDomain" />';
$output .= '<param name="movie" value="'. $url .'" />';
$output .= '<param name="quality" value="high" />';
$output .= '<param name="bgcolor" value="#e6e6e6" />';
$output .= '<embed src="'. $url .'" quality="high" bgcolor="#e6e6e6" width="400" height="15" name="xspf_player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
$output .= '</object>';
return $output;
}
?>Next you'll need to download the 'Slim' player from the website here. Transfer these files to the /modules/audio/players/ directory on your server and ensure that the shockwave file is named exactly as at the end of the $url line.
Now refresh your page (force reload by adding a '?' to the end of your url) and now everytime that Drupal tries to use theme_audio_mp3_player, which uses the standard 'button' player it will be overridden with the above code and instead use the 'Slim' player.
If you would instead like to use the 'Full' player then substitute the code after $output with the required code from the XSPF Player website.
