JavaScript Controllable Flash MP3 Player: NiftyPlayer
3
Oct
// php the_time('Y') ?>
NiftyPlayer is a tiny open source Flash MP3 player with a very simple interface.
It is lightweight (4kb) and usage does not require any Flash knowledge as the URL is mentioned in HTML.
The player can be easily controlled with JavaScript besides the Flash interface, like changing the file to be played, stop & start. With this feature, you can even bypass the whole Flash look.
Some other features are:
- Autostart capability
- Draggable/Clickable seek bar
- Simple operation with Play/Pause and Stop buttons
- Buffering with progress bar
- Buffering is stoppable! (through Stop button)
- Volume control
- Tags:
Javascript MP3
- Filed under: Flash, Goodies, MIT License, Media
- 19 Comments
















19 Responses for "JavaScript Controllable Flash MP3 Player: NiftyPlayer"
It Cool!!!!. I love it (^_^)
Anyone figure out how to get IE to respond to the onSongOver event?
Looks VERY good!! – thanks – congrats
Is there a repeat(loop)-option??
Thanks – Orest
Hi,
Is it possible to play loop ?
Thanks for your answer.
@Orestis & @toffeeonline
I believe loop is not a built-in option.
Great program!
Unfortunately the code used to embed does not validate, so I have used UFO to dynamically embed the player.
The problem with this is, I cannot get the javascript functions to work.
I want the player to respond to clicking on links, which it does beautifully when embedded into the page (non-validating), but I get the following message:
“Object does not support this property or method”
When trying to use links after embedding with UFO (validates).
I can get it to play on the page no problem, the player works fine, just hte javaqscript controls don’t.
Any ideas? I think I must be missing something really simple and obvious …
(
I am getting an error “‘undefined’ is null or not an object” in IE 8 (regardless of the mode) when trying to call niftyplayer(‘niftyPlayer1′).registerEvent(‘onSongOver’, ‘hover_off()’);
I am not sure how to eliminate this scripting error. Any ideas?
This is a great control. However, I’ve come across a problem I’m wondering if anyone can help me with.
I am using this control multiple times on a single web page that lists 20 songs for pay-per-download purposes. Each instance of niftyPlayer plays one “sample” (song excerpt) .mp3 file.
There will be 20 songs for sale; so, I will have 20 sample files to play. I put 12 instances of niftyPlayer in place on the page, and all 12 of the intended samples play/pause/stop, etc. — all works fine. But — when I add a 13th instance of niftyPlayer to the page, NONE of the instances on the page will then work.
If I remove the 13th instance, the initial 12 will work again.
If anyone can help me out here, it will really be appreciated.
To loop songs just replace song.onSoundComplete function with this one:
song.onSoundComplete = function()
{
play_btn.play_pause.gotoAndStop(‘play’);
songPosition = 0;
playingState = ‘finished’;
d_txt.text = ‘(‘ + formatTime(sP)+ ‘) stopped’;
playSong();
if (onSongOver != false) getURL(‘javascript:’+onSongOver);
}
I need a player which is hidden, and which allows me to control the volume and the playing position using JavaScript, which NiftyPlayer apparently doesn’t allow.
Here is an example using HTML5 JavaScript:
http://llbest.com/HTML5audioDemo.htm
Is this possible using Flash?
@Howard I created a custom controller for the niftyPlayer, but I too ran into the same shortcomings: No volume control nor seek ability. The Yahoo! Media Player has a more robust API, and will probably meet your needs: http://mediaplayer.yahoo.com
Here’s my blog post on the topic, which explains what I was doing, and links to several test pages using both the nifty and Yahoo players:
http://tinyurl.com/2dw7a86
Seems to be good but this SWF has fixed width/size and cannot be adjusted..
Hi, is there any approach possible with nifty players that it will play only for a predefined interval say 30 sec?
Validated code for niftyplayer XHTML 1.0 Strict
Enjoy : )
Is there an option to get current position of playhead to send that data to another webpage to have a continuos page to page player?
Hey willi, can you please explain in some greater detail how to loop a track? I swear I’ve tried every way of incorporating your bit of code into a java tag under my html document and I cannot figure out how to get it right. My song always stops at the end every time.
Do you mean that we should put the name of the song before .onSoundComplete? i would think we should put niftyplayer(‘niftyPlayer1′) but that doesn’t seem to work for me either. Please help me I’ve been trying to get this to work for days.
Hi there. How can i change the color of the white strip in the play bar? I’ve managed to customize every other element of the player, but I cannot successfully change the white strip. The element seems to be bgBar in the Flash fla file, but when i fill it with another color, it effects the button and text background areas.
Is the bgBar transparent? If so, which element can i edit to change the white color of the play progress bar which displays BEFORE the player begins to play?
Many thanks.
Can someone please tell me how can I change the color of the “loadbar” from white (default color) to something else?
Thanks.
Has any one modify the flash to this player to allow us to work with the seek-bar? that’s the only thing this player is missing the ability to see the seek bar with out the player being viable, so we can use java on the seek.