Reanimation
Reanimation

Reputation: 3336

Play AvAudioPlayer file from beginning after stop is called

So the Apple docs say this:

Discussion Calling this method, or allowing a sound to finish playing, undoes the setup performed upon calling the play or prepareToPlay methods.

Discussion The stop method does not reset the value of the currentTime property to 0. In other words, if you call stop during playback and then call play, playback resumes at the point where it left off.

After the sound file has been stopped using [mySound stop], how can you start it from the beginning again when using [mySound play] if the file wasn't fully played in the last session?

I guess my question is, how can you reset the value of currentTime property to 0?

Upvotes: 0

Views: 99

Answers (1)

J.GUI
J.GUI

Reputation: 54

Try

    AVAudioPlayer *audio = ...;
    [audio pause];
    audio.currentTime = 0.0;
    [audio play];

And see what happens.

Upvotes: 2

Related Questions