Not sure where this should go, and I'm a drupal rookie, so no diff/patch or anything fun like that. Appologies if this is the wrong location to post this in. Sorry folks ... I'll get up to speed soon. In the meantime, here is some information about how to get a Flash-based MP3 to work with MP3s and the attachment module.

Download the MP3 Player ...
http://sourceforge.net/projects/emff/
http://www.marcreichelt.de/spezial/musicplayer/#english

at around line 350 (inside function theme_attachments) add the following ... note that object and data are misspelled and will need to be corrected in your code (had to do this to get around the suspicious input check).

  if ($attachment['mimetype'] == 'audio/mp3'){
   $mLink = module_invoke('filemanager', 'url', $attachment['fid']);
   $player  = "<div class=\"player\">\n";
   $player .= '<obbject type="application/x-shockwave-flash" daata="/player.swf?src='.$mLink.'" align="middle" height="18" width="160">';
   $player .= '<param name="movie" value="/player.swf?src='.$mLink.'">';
   $player .= '</object>';    
   $player .= "</div>\n";
  }
 $output .= "</div>\n";        
 

then modify the query inside attachment_load to read ...

  $result = db_query("Select attachment.aid, attachment.title, attachment.description, attachment.fid, attachment.filename, attachment.size, attachment.hidden, `file`.mimetype From attachment Inner Join `file` ON `file`.fid = attachment.fid WHERE nid = %d", $node->nid);
 

For an example, take a look here.

I know there is a probably a better way to do this ... hopefully one of you gurus will latch on and make it into something much more effective.

Cheers,
Matt

Comments

matt_paz’s picture

The title should have read 'Getting a Flash-based MP3 Player to work with MP3s and the attachment module.'