Link to home
Start Free TrialLog in
Avatar of Dancer
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
Avatar of ocgstyles
ocgstyles

Avatar of 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
I would think that what you said last would work too...let me experiment a little bit.
ASKER CERTIFIED SOLUTION
Avatar of ocgstyles
ocgstyles

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dancer

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(TrackURL[item], true);
//     if (_root.MuteSign._visible == false)
//          this.CurSound.setVolume(this.nVolume);
//     else
//          this.CurSound.setVolume(0);
     this.CurSound.start(StartTime,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(_root.actions.nCurItem,int(_root.actions.CurSoundOffset/1000));
     }
     else
     {
          _root.PauseSymbol._visible = true;
          _root.actions.bPause = true;
          _root.actions.CurSoundOffset = _root.actions.CurSound.position;
          _root.actions.CurSound.stop();
     }
}
I wanted to take another look at this, just haven't had the time yet.....

-ocgstyles
Avatar of Dancer

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



Avatar of Dancer

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
Avatar of Dancer

ASKER

I'd be happpy to hear if you know anything new about the subject :-)

Yours,
<><
Dancer