I need to use the mp3 player as a block but whenever i build a view for it all i get is a block containing an mp3 file link. When you click on it, it gives the option to save or download. The player is fine in a page format but dissapears when i create a view. I'm a little bit of a rookike so i'm assuming i'm just missing somthing simple. Please offer any suggestions you can.

Comments

jdelaune’s picture

When you create your view and you click on the mp3 file field you should get some display options. Have you selected the MP3 Player display option?

donovank’s picture

here's the set of options i've been choosing when trying to create the view.
view type : node
adding the displays of page and block,
filefield mp3,
label : widget label mp3
format: generic files
then i define the path as the node that was created when i uploaded a test song.

hopefully this might help to make my error a bit easier to diagnose.

Thank you,
Donovan

jdelaune’s picture

Under format: do you have other options?

donovank’s picture

There are other options under format. I have these available.

Gerenic falis
image
image linked to node
image linked to file
path to file
url to file
mp3 player (default)

I chose mp3 player as a format and it started to work, now there's only one other thing. the player shows up just fine but there is a colum that looks like this creating clutter in the block:
mp3:
mp3:
mp3:
mp3:
mp3:
mp3:
mp3:
mp3:

How do i get rid of this?

jdelaune’s picture

It's probably listing nodes without embedded mp3 files. See if you can use a filter on your view to only show nodes where the mp3 field has a value?

jdelaune’s picture

Status: Active » Closed (fixed)

Let me know if you need to re-open this.

donovank’s picture

I just wanted to say thank you for your help, it's currently working perfectly.

Caveman Concepts’s picture

without CCK or views or any other extra stuff, just the MP3 player, you can drop it anywhere you want.
First, upload an mp3 file (I prefer /sites/default/files/audio so it's easy to migrate when upgrading drupal core files).
Then create a page or a new block, whatever you need.
Add the following code to the body:
.

/**
* Custom MP3 Player theme function.
*
* @param theme
*    Always set to 'mp3player'.
* @param player
*    The name of the player you want to use (default is 'Default').
* @param url
*    The URL to the mp3 file.
* @param album (optional)
*    The name of the album.
* @param artist (optional)
*    The name of the artist.
* @param description (optional)
*    A description of the mp3.
* @return A WordPress Audio Player instance.
*/
theme($theme, $player, $url, $album, $artist, $description);

Then add the code to place the actual player like this:

print theme('mp3player', 'Default', 'http://www.example.com/audiofile.mp3', 'An example file', 'John Smith', 'An optional description of the file');

THAT'S IT!
Add the block to your sidebar or promote the page to your front page or whatever you want to do.

jaap76’s picture

I added all these codes in one block, set the input to php, but nothing is showing.

jaap76’s picture

I'm now using the stand alone download and it's codes in blocks.