Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : stop streaming in my .mp3 player HELP!!!!!


tommyk104
4/24/2004 8:38:10 PM
can anyone tell me if there is a way to stop a song in the middle of it's
streaming in MX 2004? the mp3 player i'm making works great , unless you
foward thru songs to get to the 4 or 5 song, and the previous songs keep
streaming, killing the bandwidth. i've been looking for code to stop the
current stream before a new one is started. any work arounds or ideas?
Bohemme
11/27/2004 11:31:55 AM
Hey Tommyk104:
I see this message is a bit old, so I hope you have solved the problem. I have
the same now!!
I'm finishing a website and everything runs smooth localy, but having put it
in the server, I've seen some things that need some tweaking.
One of them is the streaming of the sounds. This site uses four long mp3s, and
I've seen that even if I delete the sound variable that loads them, they keep
streaming! I've also tried to create an emptymovieclip to have the music
inside, but it also failed. What I've tried now is creating an external swf in
a higher level to unload it when I need no music, but all streams keep on
loading sharing bandwidth with the rest of the loads.
I haven't seen much people taking care about this subject or posting it on the
forums. Maybe noone has realized how much this affects low bandwidths but I'd
like to solve it.
Please, please, please... Did you find a solution for this!???
NSurveyor
11/27/2004 12:42:16 PM
Bohemme
11/27/2004 1:29:58 PM
Well, having seen that this forum is alive, I'll keep on explaining more
exactly what my problem is.
In the code I create a new Sound variable. Then, I create a function to be
called from elsewhere, with the parameter "music" to know what mp3 It must
play.
StopAllsounds() is not necessary, it's there to see if it works, but mp3s keep
on streaming. When I call "musica function" it prebuffers 5 sec or so and then
begins to play. That is all right for me. But if I press another button with
_level0.musica(2);
music changes, which is great, but keeps on streaming (silently, of course)
music1.mp3!! I really have to take rid of this. I don't want to share my
client's user's bandwith with straming music that is not going to be played at
all! Even more, if I turn to first mp3, it begins streaming again, not using
what It has streamed up to that moment!
To stop the sound I use:
delete _level0.miMusica;
It stops playing, but mp3s keep on streaming!!! this is the "straming
nightmare"!! :)
Could you be more precise, DenisBB? You seem to have solved this problem. And
it's the only part left to put the site online!


--Sound Code below---

var miMusica:Sound = new Sound();

function musica(music) {
stopAllSounds();
miMusica.loadSound("mp3/music" + music + ".mp3", true);
miMusica.onSoundComplete = function () {
miMusica.start(0,10000);
}
}
musica(1);

Greets to all,
David Bravo
DenisBB
11/27/2004 3:36:37 PM
i use Sound.class
when i need not only stop a sound but stop streaming the sound i just stop
it, then i load an empty mp3 file into "sound.class".
It works for me.


--
DenisBB,
DBB crew.



[quoted text, click to view]

DenisBB
11/27/2004 7:42:49 PM
create an empty MP3 file
and when u need to stop sound and stop downloading it
just load this MP3 file
and ur player wont play anithing because this mp3 is empty,
and it wont download anything, because it downloaded this empty mp3 file
EXAMPLE:

stop_btn.onRelease = function() {
sound.stop();
sound.loadSound("empty.mp3", true);
};

--
DenisBB,
DBB crew.



[quoted text, click to view]

AddThis Social Bookmark Button