Dancer
asked on
Sound Streaming question
I'm using flash to stream some MP3s and I have a few problems:
1. I need to be able to pause/resume the streaming, I tried stopping and then starting again in a specific offset. It doesn't start at all. If I load the sound again after it was played, I can play it again but no matter what offset I as k to start it at, it starts in the beginning.
2. A similiar problem, I need to be able to jump inside the soundclip to a different position.
3. If I load a clip to an existing soundclip, the duration property updates, but the position property continues from where it was and is not set to the real position in the track.
How do I reset it? - what I did was to save the position on the track change, but I would prefare something more elegant...
Yours,
<><
Dancer
1. I need to be able to pause/resume the streaming, I tried stopping and then starting again in a specific offset. It doesn't start at all. If I load the sound again after it was played, I can play it again but no matter what offset I as k to start it at, it starts in the beginning.
2. A similiar problem, I need to be able to jump inside the soundclip to a different position.
3. If I load a clip to an existing soundclip, the duration property updates, but the position property continues from where it was and is not set to the real position in the track.
How do I reset it? - what I did was to save the position on the track change, but I would prefare something more elegant...
Yours,
<><
Dancer
ASKER
Thanks, this says that all should work fine except the stop() and then start() because of a bug in flash, but how about loading again and then starting at an offset, this doesn't work either!
How about the duration problem and playing from an offset?
<><
Dancer
How about the duration problem and playing from an offset?
<><
Dancer
I would think that what you said last would work too...let me experiment a little bit.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi, I did just that, and didn't forget to divide by 1000 (I also tried rounding it with int())
The difference between us is that I stream the sound, and you attach a loaded sound... I think that is where the problem is.
I have an array of URLs of mp3s (TrackURL[]) and an array of matching titles (TrackName[])
I commented out irrelevant stuff...
function PlayItem (item,StartTime)
{
// this.nCurItem = item;
this.bPlaying = true;
this.CurSound.loadSound(Tr ackURL[ite m], true);
// if (_root.MuteSign._visible == false)
// this.CurSound.setVolume(th is.nVolume );
// else
// this.CurSound.setVolume(0) ;
this.CurSound.start(StartT ime,1);
// _root.CurTrackName = TrackName[item]
}
I use the same button for play and pause and have a toggle bPause on the actions MovieClip. PauseSymbol displays above the playbutton when pause is on.
This is the PlayButton's onPress:
on(press)
{
if (_root.actions.bPause == true)
{
_root.PauseSymbol._visible = false;
_root.actions.bPause = false;
_root.actions.PlayItem(_ro ot.actions .nCurItem, int(_root. actions.Cu rSoundOffs et/1000));
}
else
{
_root.PauseSymbol._visible = true;
_root.actions.bPause = true;
_root.actions.CurSoundOffs et = _root.actions.CurSound.pos ition;
_root.actions.CurSound.sto p();
}
}
The difference between us is that I stream the sound, and you attach a loaded sound... I think that is where the problem is.
I have an array of URLs of mp3s (TrackURL[]) and an array of matching titles (TrackName[])
I commented out irrelevant stuff...
function PlayItem (item,StartTime)
{
// this.nCurItem = item;
this.bPlaying = true;
this.CurSound.loadSound(Tr
// if (_root.MuteSign._visible == false)
// this.CurSound.setVolume(th
// else
// this.CurSound.setVolume(0)
this.CurSound.start(StartT
// _root.CurTrackName = TrackName[item]
}
I use the same button for play and pause and have a toggle bPause on the actions MovieClip. PauseSymbol displays above the playbutton when pause is on.
This is the PlayButton's onPress:
on(press)
{
if (_root.actions.bPause == true)
{
_root.PauseSymbol._visible
_root.actions.bPause = false;
_root.actions.PlayItem(_ro
}
else
{
_root.PauseSymbol._visible
_root.actions.bPause = true;
_root.actions.CurSoundOffs
_root.actions.CurSound.sto
}
}
I wanted to take another look at this, just haven't had the time yet.....
-ocgstyles
-ocgstyles
ASKER
sure, when you have the time...
Im my previous project I used streaming sound. what I did was... I only Select Sync:Stream. in the Sound Panel.
Not so sure with this idea.
rex
Not so sure with this idea.
rex
ASKER
I guess that with loadsound it doesn't know how to jump forward... even if it is already fully loaded, probably a "known feature" kind of bug...
thanks anyway for the help.
<><
Dancer
thanks anyway for the help.
<><
Dancer
ASKER
I'd be happpy to hear if you know anything new about the subject :-)
Yours,
<><
Dancer
Yours,
<><
Dancer
http://www.flashkit.com/tutorials/Audio/Flash_MX-Kenny_Be-824/index.php