Aii Audio Player
This extensions delivers 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.
protected/extensions. 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';
If you need to use just one player per page, set the property to true
/** * * @var boolean, true if only one player appears on page */ public $singlePlayer = false;
It's an array specifying files to be played
/** * @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( );
It's a list of player options
/** * * @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( );
It's a list of flash player options
/** * * @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( );
It's an array of parameters helping to style the player the way you like.
/** * * @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( );
If you use many players on the page and you would like to set them up with the same options, this parameter is what you need.
/** * 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( );
Path to the mp3 you would like to play (and publish before playing them).
/** * * @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;
Total 13 comments
You may agree or disagree -- that's your free will! :] I've just pointed out, how it usually looks in other extensions' description or at Yii base. But, you're extension author, so it is up to you, how you will show it to the public... :] Cheers!
I have to disagree with your suggestion. It's good to know what are features that extensions serves and how to configure the extension to use them. Usually, the problem with extensions is that you have to dig or analyse the code to ensure that the extension serves the functionality you are looking for. What I did, basing on you last post, I tried to increase the readability of description of the parameters.
I don't think, that pasting large blocks of comments in your example code, along with all options, parameters and switches' description is a wise idea. It only blurs the most important parts. Anyone can always dig into your source code to find out this. Consider re-editing extension description and removing all the comments from example code.
Hi vladotg, On current implemntation it's not foreseen to use external (remote) files for playing in the player, but there is a hope for you. You may try to do following: 1) Create your own implementation of the player inheriting from my class with own implementation of method init(); 2) Add at the end of overwritten init method call
3) Pass links to mp3 files into 'otherResToPublish' property of the player.
4) Let me know if it works :)
Cheers, Tomek
Is it possible to play remote mp3 files? Perhaps, mp3 is on url: www.mp3files.com/blah.mp3. If I set that in 'soundFile' parameter, exception is raised.
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:
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!!!
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
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...
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
Thx a lot for above remarks. Please note that new version of this extension is inroduced
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 !
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!!
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 login to leave your comment.