MP3-jPlayer

Auto adds an mp3 audio player to pages / posts that you make a playlist on. Can be customised into themes.


Contributors: simon.ward
Donate link:
Tags: mp3, audio, player, music, jplayer, integration, music player, mp3 player, playlist, media, jquery, javascript, plugin, shortcode, css, post, page, sidebar
Requires at least: 2.8
Tested up to: 3.0.1
Stable tag: 1.3.4


Description

Version 1.3.4 adds a set of template tags for sidebar/header players etc, new shortcode options including centering and download setting, and a smaller player size option.

Features:


See a Demo here


The player can be added to the most recent post on the post index (that has a playlist), or using template tags it can be put in sidebars/headers etc, fed a playlist, appear on archive pages, and set a stylesheet. Player has sliders, loader bar, status info, and optional download button.



Making a Playlist

Add tracks on page/post edit screens using the custom fields (below the content box), as follows:

  1. In the left box of a new custom-field enter:

    mp3

  2. Write the filename or URI* of the mp3 into the right box and hit 'Add custom field'.

Repeat the above to add more tracks, and hit the 'update/publish' button when you're done.


*Use a full URI when the mp3 is not in either a) the library or b) from the default folder/uri. You'll need to set the default folder that you want to use on the settings page.



Adding a Title

Add titles in the right box, before the filename (or uri), separate with an @ sign, eg:

Title@filename



Adding aCaption

Add the caption in the left hand box after 'mp3', separate with a dot, eg.

mp3.Caption

You can blank out a library caption (or a caption that's been carried over from a previous track) by using just the dot (ie. 'mp3.')



Play Order

To control the playlist order number the left hand boxes, eg:

1 mp3


2 mp3.Caption


3 mp3.Another Caption



Shortcode

Using the shortcode is optional, it lets you position the player within the content rather than at the top of it, and has 4 optional attributes for controlling the position (pos), download setting (dload), autoplay (play), and show playlist (list) on each page. The shortcode is:

[mp3-jplayer]

The attributes are:

pos: left, right, rel (or none), rel-C, rel-R, absolute

dload: true, false

play: true, false

list: true, false


for example

[mp3-jplayer play="true" pos="rel-C" dload="true"]



Template Tags

Quick example: Make the player move to sidebar on the posts index and play 5 random tracks from your library

Put this in index.php before the posts loop starts:

<?php if ( function_exists('mp3j_flag') ) { mp3j_flag(); } ?>


Put this in sidebar.php somewhere below the opening div(s):

<?php 
if ( function_exists( 'mp3j_grab_library' ) ) { 
    $lib = mp3j_grab_library();
    $files = $lib['filenames'];
    shuffle( $files );
    $files = array_slice( $files, 0, 5 );
    mp3j_set_meta( $files );
    mp3j_put( 'feed' );
}   
?>


To use the smaller player stylesheet on the above example put this in header.php above wp_head():

<?php 
if ( function_exists('mp3j_addscripts') ) { 
    if ( is_home() ) {
        mp3j_addscripts('/wp-content/plugins/mp3-jplayer/css/mp3jplayer-blu-sidebar.css'); 
    }
}
?>



Tag Details

Note: there's an admin option to ignore the tags which needs to be unticked when you want to use them!

mp3j_addscripts( $style )


mp3j_flag( $set )


mp3j_grab_library( $format )


mp3j_set_meta( $tracks, $captions )


mp3j_put( $mode, $position, $dload, $autoplay, $playlist )


mp3j_debug($info)



Best to use function_exists() to make sure the tags exist before running them, eg:

<?php if ( function_exists('mp3j_addscripts') ) { mp3j_addscripts('styleD'); } ?>

Running them without checking when the plugin is not activated will throw an error.



Installation

To install using Wordpress:

  1. Download the zip file to your computer.
  2. Log in to your Wordpress admin and go to 'plugins' -> 'Add New'.
  3. Click 'Upload' at the top of the page then browse' for the zip file on your computer and hit the 'Install' button, Wordpress should install it for you.
  4. Once installed go to your Wordpress 'Plugins' menu and activate MP3-jPlayer.

To Install manually:

  1. Download the zip file and unzip it.
  2. Open the unzipped folder and upload the entire contents (1 folder and it's files and subfolders) to your /wp-content/plugins directory on the server.
  3. Activate the plugin via your Wordpress 'Plugins' menu.

Frequently Asked Questions

Can the player go in the header/sidebar?

Yes from this version 1.3.4 if you use template tags. It's not a widget yet so you can't do it from the admin area currently.

Why is the default folder set to your domain?

It's not anymore, it was going to be for testing a default install without needing to know any mp3's. So you could activate, go to a page and use 'test' as the filename and it would play that file from my domain, but a)i forgot to mention it, and b)it's prob not that useful. On fresh install it's now set to the root of your domain.


Screenshots

  1. Player
  2. Admin settings page
  3. Playlist example

Changelog

1.3.4

1.3.3

1.3.2

1.3.1

1.3.0

1.2.12

1.2.0

1.1.0

1.0