Go back to AudioField

Installation

In order to activate this module you have to get one of audio players from the following links
1. http://wpaudioplayer.com/download *Note make sure you should download the standalone edition
2. http://sourceforge.net/projects/musicplayer/files/musicplayer/slim-playe...
3. http://www.premiumbeat.com/flash_music_players/original/single/
4. http://www.premiumbeat.com/flash_music_players/original/thin/
5. http://www.premiumbeat.com/flash_music_players/original/mini/
(Premiumbeat.com no longer offers the music players)
6. Install FlowPlayer module (http://drupal.org/project/flowplayer) to use Flowplayer (optional)
7.http://www.jplayer.org/ VERSION 2.0, not 2.1 (7.x-1.x only)
8. Soundmanager2 http://www.schillmania.com/projects/soundmanager2/doc/download/
9. Use Google reader player, no installation required. NEW

Where to extract the players?

Once you have installed any of the above audio players you must create a new folder called "player "at this
directory "sites/all/libraries". Now you can unzip the audio players directly into the "player" folder.
If you wish to save players in a different folder you can change it from admin/settings/audiofield and enter the new path under "Audio Players Directory".

If using the default settings, resulting folder structure should resemble the following (you may need to rename the folders and files to match):

> The standalone WordPress player should be at:
/sites/all/libraries/player/audio-player/player.swf

> The slim player should be at:
/sites/all/libraries/player/xspf_player_slim.swf

> The Premium Beat single track player should be at:
/sites/all/libraries/player/playerSinglePackage/playerSingle.swf

> The Premium Beat single track thin player should be at:
/sites/all/libraries/player/OriginalThinMusicPlayer.swf

> The Premium Beat single track mini player should be at:
/sites/all/libraries/player/LWMusicPlayer.swf

>The jPlayer should be at:
/sites/all/libraries/player/jPlayer/Jplayer.swf

>Soundmanager2 should be at:
/sites/all/libraries/player/soundmanager2/script/soundmanager2.js

Select default player

Go to admin/settings/audiofield and you will see list of available players. Player you select will be used as default player for all audio files.

Add audio upload to the content type

First you must add audiofield to the preferred content type. Adding a field is done as adding any other CCK field, select field type of "File" and widget of "Audio Upload".

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.

API

Originally this module supports only mp3 audio files. But other modules can extend this support by implementing hook_audiofield_players() in their modules.

For example to implement support for new example player you would do:

/* Example of creating additional players through hook_audiofield_players() */
function example_module_audiofield_players(){
	$players['example']=array(
		'path' => drupal_get_path('module','example_module').'/players/player.swf', //relative path to the player
		'name' => 'Example player',
		'download_link' => 'http://example.com/download',
		'filetypes' => array('mp3','wav','wma'),   //List of audio files your player can play
		'callback' =>'example_module_example_player',
	);
	
	return $players;
}

function example_module_example_player($player_path,$audio_file){
return '<object><param name="autoplay" value="true" />
            <param name="controller"value="true" /> 
            <embed src="' . $player_path . '"  width="65" height="21" float="left" wmode="transparent" flashvars="mediaPath=' . $audio_file .'&defaultVolume=100" autostart="true" loop="false"  controller="true" bgcolor="#FF9900" pluginspage="http://www.macromedia.com/go/getflashplayer" >
            </embed></object>';
}