-
Nonstop Mp3 Player without play and pause button
Dear friends,
I checked all flaskit sources and tutorials. All of them are telling about mp3 players with stop, play and pause buttons.
Is there any source or tutorial about a radio which continiously play songs ? No pause, no play, no stop button. it will play songs in specific folder nonstop in loop. ?
thank you for your answers
-
The control buttons are just a little graphics that happens to have some actionscript attached to them. There's no rule that says you have to use them. So just remove the button graphics or eliminate the actionscript attached to them and there is your mp3 player with no controls.
For any tutorial that includes control buttons, just don't create the buttons.
In AS2 the loadSound(); is what starts the mp3 playing, just don't have any controls.
http://www.gotoandlearn.com/index.php?currentpage=9
Best wishes,
Video Man
-
Thank you so much for your answer Video Man... It is my fault that i didnt explain enough. And honestly my question is a lil bit wrong as i understood from your answer.
Yes easy way to remove controls.. But main problem is, such as, i open the player link and begin to listen the player. Then you open the same link later. We must both listen the same song at the same time..
Here is the code. cps, currently playing song must be the curently playing song. Not the first one.. In this code, player goes always for the first song and play first one which i dont want..
// Setup sound object
var s:Sound = new Sound();
s.onSoundComplete = playSong;
s.setVolume(75);
// Array of songs
var sa:Array = new Array();
// Currently playing song
var cps:Number = -1;
// Load the songs XML
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes:Array = this.firstChild.childNodes;
for(var i=0;i<nodes.length;i++)
{
sa.push(nodes[i].attributes.url);
}
playSong();
}
xml.load("songs.xml");
// Play the MP3 File
function playSong():Void
{
if(cps == sa.length - 1)
{
cps = 0;
s.loadSound(sa[cps], true);
}
else
{
s.loadSound(sa[++cps], true);
}
}
Thank you for your help
Last edited by kredno; 12-07-2010 at 02:00 PM.
Reason: adding as
-
To play the next song you need to use the "onSoundComplete"
So let's just say that you have a "Next" button to play the next song in your playlist. Instead of having the actual button do the action, call that function thru "onSoundComplete"
Here's an example of the code from my mp3 player's "Next" function:
Code:
function nextSong() {
if (songArray[currentIndex +1]) {
currentIndex++;
}
else
{
currentIndex = 0;
}
jukebox.loadSound(urls[currentIndex],true);
title_txt.text = titles[currentIndex];
}
Now call that function when it gets to the end of one song:
Code:
jukebox.onSoundComplete = nextSong;
Of course you need to adapt this code to your array and your sound (my sound is named jukebox).
So that will get one song to play one after the other...
But to get the same song to play at the same time on two different browsers, you'll need to use true streaming audio. And that's a HUGE jump up in cost and technical effort. But it could be done... all it takes is money!
Look into Flash Media Server:
http://www.adobe.com/products/flashmediaserver/
or Red5:
http://www.osflash.org/red5
Best of luck to you on your project,
Video Man
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|