I have configured Audiofield to use the XSPF Slim Player. It displays the player, but when you click on the play button, it shows a playlist of one that reads:

1. undefined

Is there a way to get the Description field to appear in the playlist?

Drupal 6.20
audiofield-6.x-1.0
cck-6.x-2.9
contemplate-6.x-1.2
filefield-6.x-3.9
image-6.x-1.1
imageapi-6.x-1.9
imagecache-6.x-2.0-beta10
imagefield-6.x-3.9
thickbox-6.x-1.6
views-6.x-2.12

CommentFileSizeAuthor
#1 xspf_player.jpg1.55 KBstanb
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stanb’s picture

FileSize
1.55 KB

Here's a screen capture of the problem:

plastikkposen’s picture

Hi.
Could be the directory your files are located:

Fromt the readme.txt:
"Finally you have to put any mp3 audio file at "\sites\all\libraries\player\"
and you have to name it as Sample_Track.mp3, this step just to gives the ability
to test all audio players before you choose your default audio player"

However you can change the default directory in the audiofile.module file. Search for this line:
'path' => variable_get('audiofield_players_dir', 'sites/all/libraries/player')

You might "need" the pathauto module and the filepathauto module to get the uploaded files to the right directory.

stanb’s picture

plastikkposen, thanks for your reply. Yes, I see now the part about sample_track.mp3 but that appears to be there for testing, although I don't see how it is a test. Why would you need to manually upload a sample file here? The point of the module (I thought but perhaps I am wrong) is to allow one to browse a local machine and upload a file using the Upload Widget that is specified as a CCK field after creating a content type for this purpose.

I looked at audiofield.module and 'path' => variable_get('audiofield_players_dir', 'sites/all/libraries/player') actually looks like the path to the player not to the mp3 file.

The installation instructions (http://drupal.org/node/973194) read:

"How to upload and play audio file?

After adding audiofield to content type you can upload audio files when creating new nodes. Uploaded audio files will be rendered in default player you selected in admin form."

So, here's what I did. I created a content type called Audio Gallery and created a new field called Audio with Widget Type = Audio Upload for the Audio Gallery content type.

The default upload path for uploaded files is "sites/default/files", so when I create an Audio Gallery content type, it allows me to browse my local machine, select a file, and upload it. I have limited control over which directory the file gets uploaded to. I can specify a path beneath "sites/default/files" by configuring the field Path Settings in the Audio Gallery Content Type but that's as much control as I have.

I don't understand why a sample file must be uploaded to "\sites\all\libraries\player\" since:
1. this is the location of the player not the mp3 source files
2. the path is determined by the Audio Upload field in the CCK after AudioField is installed not a path of my choosing.

If you think there maybe something wrong with the way I have configured the content type or installed the module, please let me know. Thanks.

tamerzg’s picture

sample_track.mp3 is optional mp3 to test players at admin configuration page (admin/config/audiofield). It doesn't have anything to do with uploading other files via cck field. The way you did is correct. Mp3 filename should show in a player, not description. Since each player has its own theming function you can try to override that and adjust player parameters per your needs.

stanb’s picture

tamerzg, thank you for replying. I understand the function of the sample_track.mp3 file now. Unfortunately, when I go to AudioField under Site Configuration and try to play the sampe file, it does not play. The WP Player reads "Connecting..." and spins its wheels. The XSPF Player does nothing.

My issue with the playlist being undefined though is now resolved BUT ONLY when using the WP Player. In order to get a description in the playlist I had to enter a Title for the mp3 file, i.e., right click on the filename, go to Properties -> Summary, enter a title and save the file. Then when I upload it, the Title appears in the playlist.

The XSPF Music Player still does not display a playlist. I even tried clearing the cache but that did not help either.

I guess I will try to theme the WP Player to suit the look of my site. I see that the player theme is defined in the audiofield.module with the Callback function here:

function theme_audiofield_players_wpaudioplayer($player_path, $audio_file){
  return '<object id="audioplayer2" height="24" width="290" data="' . $player_path . '" type="application/x-shockwave-flash">
                          <param value="' . $player_path . '" name="movie"/>
                          <param value="playerID=2&amp;bg=0xCDDFF3&amp;leftbg=0x357DCE&amp;lefticon=0xF2F2F2&amp;rightbg=0xF06A51&amp;rightbghover=0xAF2910&amp;righticon=0xF2F2F2&amp;righticonhover=0xFFFFFF&amp;text=0x357DCE&amp;slider=0x357DCE&amp;track=0xFFFFFF&amp;border=0xFFFFFF&amp;loader=0xAF2910&amp;soundFile=' . $audio_file . '" name="FlashVars"/>
                          <param value="high" name="quality"/>
                          <param value="false" name="menu"/>
                          <param value="wmode" name="transparent"/>
                          </object>';
}

But I have no idea of where to begin to override/utilize this function. Can you point me in the right direction? Is there documentation I can read about using callback functions? I would like to have this function applied to all pages of a specific content type. Thanks for any help.

tamerzg’s picture

You can copy that function to your theme template.php file and rename it to phptemplate_audiofield_players_wpaudioplayer
After that clear the cache and it should work.

stanb’s picture

I'm using the Zen theme with a sub theme that I created in sites/all/themes/subzen. Will renaming the function to phptemplate_audiofield_players_wpaudioplayer still work?

My template.php file is in sites/all/themes/subzen/template.php.

Thanks again for your help and guidance.

tamerzg’s picture

Yes it will work.

stanb’s picture

Yes, it DOES work! Thank you so much. I only wish I understood WHY it works. I know that Drupal looks in the sites/all/themes folder for template.php but how it knows to associate this function with your module, I don't have clue.

If you wouldn't mind telling me which Drupal docs I can read that may help me begin to understand this, I would be very appreciative. Thanks again for you guidance.

tamerzg’s picture

Maybe you can start with this: http://drupal.org/documentation/theme
The thing is that you can override any theming function (ones that starts with theme_) in your theme template.php.

tamerzg’s picture

Status: Active » Closed (works as designed)
sheldonkemper’s picture

Version: 6.x-1.0 » 7.x-1.x-dev
Component: User interface » Code
Category: support » bug
Status: Closed (works as designed) » Needs review

Can someone help? I'm having the same issue as initially described in this thread. Its a shame this thread took a tangent towards WP player. The issue for xspf player is not solved for me. The mp3 plays, but the track listing show 'undefined'.

ws.agency’s picture

Issue summary: View changes
Status: Needs review » Needs work

Module needs work. Issue with listing track name still 'undefined'

Anonymous’s picture

Added song title parameter. "Undefined" fixed.

Anonymous’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.