1

I'm using the AudioStreamer class from mattgallagher for quite a few time but only now I am implementing the progress slider with the seconds info.

The label with timePlayed/totalDuration is working like a glove, and the seeker progress is being updated correctly.

The thing is when I move the slider to a new position is starts the streaming from the beginning with the slider on the new position.

I tried to track the AudioStreamer.m to see what I was missing but couldn't find. Is it a problem with the stream missing some info?

Andre Cytryn
  • 2,506
  • 4
  • 28
  • 43

1 Answers1

1

You need to make sure that in the updateProgress method, you are setting the sliders value so it keeps getting updated within the timer;

double progress = self.audio.progress;
double duration = self.audio.duration;
[progressSlider setValue:100 * progress / duration];

The what I did was create a method that gets called on the Touch Up Inside and Touch Up Outside event of the slider;

- (IBAction)endSeeking:(UISlider *)sender {
    double duration = self.audio.duration;
    double newtime = (duration / 100) * sender.value;
    [self.audio seekToTime:newtime];
}

Hope that helps.

Wasim
  • 4,953
  • 10
  • 52
  • 87