audio-player-wordpress-plugin

Delivers Worldpress Audio Player created by 1pixelout for non-Worldpress based projects (now called aii-audio-player)
6 followers

Aii Audio Player

(knows later as Audio Player Wordpress Plugin )

This extensions delivert audio player, which you may use on you site. You can customize its outlook and use as many players on one page as needed. It's a port of Wordpress extension created by 1 Pixel Out with changes introduced by Mindy McAdams for non-Wordpress based sites.

Documentation

Requirements

  • Yii 1.0.9 or above

Installation

  • Extract the release file under protected/extensions.
  • Install AiiPublishRegisterBehavior extension

Usage

See the following code example:

/* create widget in you view file */
<?php $this->widget( 
    'AiiAudioPlayer' , 
        array ( 
            'playerID' => 'mpl',        
            'singlePlayer' => true,
            'trackOptions'=> array( 'soundFile' => 'blah.mp3' , 'alternative' => 'nothing' ),
            'flashPlayerOptions' => array( 'width' => 350 ),
    ) ); ?>

Above example creates one player which will play blah.mp3 from protected/extensions/aii-audio-player/mp3.

If you need to use more than one player per page, you have to set unique value of parameter `playerID' for each widget.

/**
     * @var string - Player Id (needed when using multiple players on one site)
     * default to 'audioplayer'
     */
    public $playerID = 'audioplayer';
 
    /**
     * 
     * @var boolean, true if only one player appears on page
     */
    public $singlePlayer = false;
 
    /**
     * @var array - list of mp3 files {@link mp3Folder}
     * It's an array with 4 entries
     * - soundFile - required, comma-delimited list of mp3 files
     * - alternative - required, alternative content if player will not be displayed 
     * - titles - optional, comma-delimited list of titles (overrides ID3 information) 
     * - artists - optional, comma-delimited list of artists, overrides ID3 information
     * with this way of declaration you will get one player with one or multiple mp3s.
     * Example:
     *  <code>
     *      array( 
     *          'soundFile' => "example.mp3, interview.mp3", 
     *          'titles' => "Example MP3 , My latest interview",
     *          'artists' => "Artist name 1, artist name 2"
     *          'alternative' => "sorry, no file found"
     *      );
     *  </code>
     * If you wan't to create more than one player, 
     * please pass to this property array of aforementioned options
     * with player ids. I
     * Example:
     *  <code>
     *      array(
     *          'player1' => array(
     *              'soundFile' => "poker_face-lady_gaga.mp3", 
     *              'alternative' => "sorry, no file found"
     *          ), 
     *          'player2' => array( 
     *              'soundFile' => "example.mp3, interview.mp3", 
     *              'titles' => "Example MP3 , My latest interview",
     *              'artists' => "Artist name 1, artist name 2"
     *              'alternative' => "sorry, no file found"
     *          ); 
     *      );
     *  </code>
     */
    public $trackOptions = array( );
 
    /**
     * 
     * @var array list of player options
     * Below code shows also default values
     *  <code>
     *      array (
     *          'autostart' => "no",    //if yes, player starts automatically
     *          'loop'      => "no",    //if yes, player loops
     *          'animation' => "yes",   //if no, player is always open
     *          'remaining' => "no",    //if yes, shows remaining track time rather than ellapsed time
     *          'noinfo'    => "no",    //if yes, disables the track information display
     *          'initialvolume' => 60,  //initial volume level (from 0 to 100)
     *          'buffer'    => 5,       //buffering time in seconds
     *          'encode'    => "no",    //indicates that the mp3 file urls are encoded
     *          'checkpolicy' => "no"   //tells Flash to look for a policy file when loading mp3 files
     *          (this allows Flash to read ID3 tags from files hosted on a different domain)
     *          'rtl'       => "no"     //switches the layout to RTL (right to left) for Hebrew and Arabic languages
     *      );
     * </code>
     * 
     * If you would like to specify different options to each player 
     * please pass array of array options here, where key in first array is player id
     * Example:
     *  <code>
     *      array(
     *          'player1' => array ( ... ), //header options for 1st player
     *          'player2' => array ( ... ), //header options for 2nd player
     *          ...
     *          'playerN' => array ( ... ), //header options for Nth player
     *      );
     *  </code>
     */
    public $playerOptions = array( );
 
    /**
     * 
     * @var array list of flash player options
     *  <code>
     *      array(
     *          'width' => 290,                 //required, width of the player. e.g. 290 (290 pixels) or 100%      
     *          'transparentpagebg' => "no",    //if yes, the player background is transparent (matches the page background)
     *          'pagebg' => NA,                 //player background color (set it to your page background when transparentbg is set to ‘no’) 
     *      );
     *  </code>
     * 
     * If you would like to specify different options to each player 
     * please pass array of array options here, where key in first array is player id
     * Example:
     *  <code>
     *      array(
     *          'player1' => array ( ... ), //header options for 1st player
     *          'player2' => array ( ... ), //header options for 2nd player
     *          ...
     *          'playerN' => array ( ... ), //header options for Nth player
     *      );
     *  </code> 
     */
    public $flashPlayerOptions = array( );
 
 
    /**
     * 
     * @var array of colour scheme options
     *  <code>
     *      array(
     *          'bg' => "E5E5E5",               //Background
     *          'leftbg' => "CCCCCC",           //Speaker icon/Volume control background
     *          'lefticon' => "333333",         //Speaker icon
     *          'voltrack' => "F2F2F2",         //Volume track
     *          'volslider' => "666666",        //Volume slider
     *          'rightbg' => "B4B4B4"           //Play/Pause button background
     *          'rightbghover' => "999999"      //Play/Pause button background (hover state)
     *          'righticon' => "333333"         //Play/Pause icon
     *          'righticonhover' => "FFFFFF"    //Play/Pause icon (hover state)
     *          'loader' => "009900",           //Loading bar
     *          'track' => "FFFFFF"             //Loading/Progress bar track backgrounds
     *          'tracker' => "DDDDDD",          //Progress track
     *          'border' => "CCCCCC",           //Progress bar border
     *          'skip' => "666666",             //Previous/Next skip buttons
     *          'text' => "333333",             //Text
     *      );
     *  </code>
     * 
     * If you would like to specify different options to each player 
     * please pass array of array options here, where key in first array is player id
     * Example:
     *  <code>
     *      array(
     *          'player1' => array ( ... ), //header options for 1st player
     *          'player2' => array ( ... ), //header options for 2nd player
     *          ...
     *          'playerN' => array ( ... ), //header options for Nth player
     *      );
     *  </code>
     */    
    public $colourSchemeOptions = array( );
 
    /**
     * Options used to initialize all players. The are overwritten 
     * options set via {@link playerOptions}, {@link flashPlayerOptions} , 
     *  <code>
     *      array(
     *          AiiAudioPlayer::OPTION_PLAYER = array ( 
     *          ... here options like in {@link playerOptions}
     *          ),
     *          AiiAudioPlayer::OPTION_FLASH = array (  
     *          ... here options like in {@link flashOptions}
     *          ),
     *          AiiAudioPlayer::OPTION_COLOUR = array ( 
     *          ... here options like in {@link colourOptions}
     *          ),
     *      );
     *  </code>
     * 
     * {@link colourSchemeOptions}
     * @var array
     */
    public $setupOptions = array( );
 
    /**
     * 
     * @var string - Publised folder with mp3 files
     * Default to null, which means that standard '{basepath}/mp3' folder under
     * extension directory will be published
     */
    public $mp3Folder = null;

Change Log

Release 0.2.0

March 14,2010

  • extension is using now latest standalone version 2.0 of WordPress Audio Player
  • integrated with AiiPublishRegisterBehavior extension
  • array-based instead of property-based configuration of player
  • support for creating more than one players using one widget
  • support for playing more mp3 in one player
  • code clean up

Release 0.1.0

March 11,2010

(deprecated and not supported)

  • Renamed extension to yii-audio-player
  • SVN repositorry added
  • New release 0.1.0 avaliable
  • New height and widht property added
  • Enhancement error handling
  • Code clean up
  • Render method completely rewritten. Echoes used instead of view file
  • two defualt skins added

Release 0.0.1

September 19, 2009

(deprecated and not supported)

  • Initial release (not supported yet)

Total 8 comments

#7504 report it
alex-ks at 2012/03/26 06:37pm
J.width is undefined

It's not working with miltiple files on the page. When I set 'singlePlayer' => false, And added dynamic IDs player is not working. JS error: J.width is undefined audio-player.js (line 1) How to fix it?

this is how i setup it:

<?php
    Yii::import('application.extensions.aii-publish-register-behavior.AiiPublishRegisterBehavior');
    Yii::import('application.extensions.aii-audio-player.AiiAudioPlayer');
    $this->widget(
        'AiiAudioPlayer',
        array (
            'playerID' => 'mpl_'.$model->track_id,
            'singlePlayer' => false,
            'mp3Folder'=> 'media/audio/'.$model->album->id,
            'trackOptions'=> array( 'soundFile' => empty($model->name)? 'nothing' : $model->name , 'alternative' => 'nothing' ),
            'flashPlayerOptions' => array( 'width' => 350 ),
    ) );
?>

UPD: Solved! problem is here X:\home\kramba\www\protected\extensions\aii-audio-player\AiiAudioPlayer.php line 412 When you change YII_DEBUG to false it not working!!!

#5279 report it
Alex Adams at 2011/09/29 08:33pm
Path confusion?

I am trying to get this working. I get the widget showing up on the view page, but it always says file not found.

Here is what I have in the widget: $file_path=Yii::app()->getBasePath().'/../hawk/audios/'.$model->internal_file_name; $this->widget('ext.aiiaudioplayer.AiiAudioPlayer', array( 'playerID'=>'audioplayer', 'singlePlayer'=>true, 'trackOptions'=>array('soundFile'=>$file_path, 'alternative'=>'nothing'), 'flashPlayerOptions'=>array('width'=>350), )); This file exists. I can download it, but I get File Not Found.

To dumb things down, I copied a file to the aiiaudioplayer/mp3 folder and hard coded it's name into the widget call:

$this->widget('ext.aiiaudioplayer.AiiAudioPlayer', array( 'playerID'=>'audioplayer', 'singlePlayer'=>true, 'trackOptions'=>array('soundFile'=>'4-jazz2.mp3', 'alternative'=>'nothing'), 'flashPlayerOptions'=>array('width'=>350), ));

Still No File Found message.

Ideas?

Thanks,

Alex

#4022 report it
dinhtrung at 2011/05/29 12:35pm
Javascript N.width error

I tried to use this extension, but could not load the player. I use Firefox 4, and the browser complain about N.width is undefined. Don't know how to fix. Download the lastest standalone version for this, but not work...

#709 report it
aztech at 2010/03/14 01:34pm
New release 0.2.0

New release uplaoded. Now palyer is integrated with latest WordPress Audio Player. Note that new interface is incompatibile with previous releases but makes extension more flexible

#726 report it
aztech at 2010/03/10 08:54pm
Thx a lot ...

Thx a lot for above remarks. Please note that new version of this extension is inroduced

#863 report it
smoothcoder at 2010/02/16 01:02pm
Eventually solved on linux

You had it all right scoob.junior even if I first missed step #3 (.swf and .js are now much bigger)

I tested on Linux Ubuntu Karmic and lighttpd webserver . Works like a charm under Firefox 3.5.7, Chrome even KDE konqueror ! My tests here

Great extension !

#1250 report it
scoob.junior at 2009/10/14 09:32am
Solved

Three steps to get it working:

1st - make the code change in AudioPlayerWordPressPlugin.php, as I mentioned in the previous post

#register JS File $this->playerJSFile=CHtml::asset($assets.DIRECTORY_SEPARATOR.$this->playerJSFile); $cs=Yii::app()->clientScript; if($cs->isScriptRegistered($this->playerJSFile)===false)
$cs->registerScriptFile($this->playerJSFile);

2nd - Remove/Deactive Flash Player 9 and Install Flash Player 10

3 - Download the new version (2) of the player from this url: http://wpaudioplayer.com/download After, delete all files under extensions/APWPPLugin/assets and webapp/assets. Just paste the content of the downloaded file of the new version of the player under extensions/APWPPLugin/assets

Enjoy a new version of the player working in: Windows - FF3.5, IE8 and Chrome

Haven't tested in Linux yet.

Thanks for the great Extension!

Regards!!

#1251 report it
scoob.junior at 2009/10/14 07:04am
Haven't worked for me

First, I got an error in the AudioPlayerWordPressPlugin.php. I solved it by changing #register JS File $this->playerJSFile=CHtml::asset($assets.DIRECTORY_SEPARATOR.$this->playerJSFile); $cs=Yii::app()->clientScript; if($cs->isScriptRegistered($jsFile)===false)
$cs->registerScriptFile($jsFile);

to

    #register JS File
  $this->playerJSFile=CHtml::asset($assets.DIRECTORY_SEPARATOR.$this->playerJSFile);
  $cs=Yii::app()->clientScript; 
  if($cs->isScriptRegistered($this->playerJSFile)===false)     
    $cs->registerScriptFile($this->playerJSFile);

The player now appears in the page, but when I press play button, it goes from left to right, sound starts playing and the play button returns to the left and sound stops.

This behavior was noticed in IE8, FF 3.5. Running Chrome, the sound doesn't even start.

What I'm doing wrong?

Thanks!

:>)

Leave a comment

Please to leave your comment.

Create extension
  • License: New BSD License
  • Developed by: aztech
  • Category: Others
  • Votes: +3
  • Downloaded: 480 times
  • Created on: Sep 19, 2009
  • Last updated: Mar 14, 2010