Hi,
Thanks for the module.
The standalone WordPress player displays "Track #1" as title of the mp3.
How can I display the description text of my mp3 field ?
Thanks for your help.

Comments

gagarine’s picture

Title: Title of standalone WordPress player » Send the field to the players so we can display the file's title
Version: 7.x-1.0-beta4 » 7.x-1.x-dev
Component: Miscellaneous » Code

Right now it's not possible.

The formater look like that.

//theme_audiofield_formatter_audiofield_embedded()
//...
  $audiofile=file_create_url($file->uri);
  $info = pathinfo($audiofile);
  $op = $info['extension'];
  $output = audiofield_get_player($audiofile, $op,$variables);

We should change just one line, so player can have access to the file title.

  $output = audiofield_get_player($audiofile, $op, $variables);

Careful this is an API change... but perhaps audiofield_get_player function can do a "function_exist" or something like that to keep backward compatibility.

EDIT in fact call_user_func should already take care of that...

So we will just have to add the arg to call_user_func in audiofield_get_player.

/**
 * Get the object for the suitable player for the parameter resource
*/
function audiofield_get_player($audio_url, $op,$variables) {
  global $base_path;
   //Lets convert $op to lowercase
   $op = strtolower($op);
   $audio_players=audiofield_players();
   $variable_name = 'audiofield_audioplayer' . ($op == 'mp3' ? '' : "_$op");
   $player = $audio_players[variable_get($variable_name, '')];
   if (empty($player)) {
     return audiofield_embeddedplayer($audio_url);
   }
  return call_user_func($player['callback'], $base_path . $player['path'], $audio_url,$variables);
}
gagarine’s picture

Daniel.Moberly’s picture

Issue summary: View changes
Status: Active » Closed (outdated)