?
Solved

Sound Streaming question

Posted on 2003-03-01
10
Medium Priority
?
202 Views
Last Modified: 2010-04-03
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
0
Comment
Question by:Dancer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 5

Expert Comment

by:ocgstyles
ID: 8047852
0
 

Author Comment

by:Dancer
ID: 8047972
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
0
 
LVL 5

Expert Comment

by:ocgstyles
ID: 8048448
I would think that what you said last would work too...let me experiment a little bit.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

by:
ocgstyles earned 400 total points
ID: 8048791
here is code that i did.  one mistake i was making was that, the position property is in milliseconds.  you may be making the same mistake.  the offset time is in seconds.  i had two buttons on the stage, one calls the playAmber function and the other calls the pauseAmber function.  if this isn't close, post the code you are using so i can get a better idea.

//frame 1
paused_loc = 0;
playing = false;

function createAmber(loc){
     amber = new Sound();
     amber.attachSound("amber3");
     dur.text = amber.duration;
}

function playAmber(){
     createAmber();
     amber.start(paused_loc,999);
     trace("started at " + paused_loc);
     gotoAndPlay(5);
     playing = true;
}

function pauseAmber(){
     paused_loc = amber.position/1000;
     amber.stop();
     trace("paused at " + paused_loc);
     playing = false;
}
createAmber();
stop();

//play button
on(press){
  playAmber();
}

//pause button
on(press){
  pauseAmber();
}

-ocgstyles
0
 

Author Comment

by:Dancer
ID: 8048874
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();
     }
}
0
 
LVL 5

Expert Comment

by:ocgstyles
ID: 8058112
I wanted to take another look at this, just haven't had the time yet.....

-ocgstyles
0
 

Author Comment

by:Dancer
ID: 8060006
sure, when you have the time...
0
 
LVL 9

Expert Comment

by:rexmor
ID: 8069019
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



0
 

Author Comment

by:Dancer
ID: 8070705
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
0
 

Author Comment

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

Yours,
<><
Dancer
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question