Reputation: 449
I have an application using AVFoundation that plays use an mp3 sound file as a sound effect. It's recorded length is 90 seconds long. However, I play it repeatedly, on and off dependant upon varying things, for different lengths of time by utilising the tickingSounds.play() and tickingSounds.stop(). It seems however once I get to 90 seconds that it won't play anymore. I am assuming the play() command resumes from where I last stopped it?
My question is how do I reset it play position or am I missing something else?
Upvotes: 0
Views: 66
Reputation: 4337
You should set:
numberOfLoops
Set the Property numberOfLoops to -1 and it would go into infinite loop.
numberOfLoops
The number of times a sound will return to the beginning, upon reaching the end, to repeat playback.
@property NSInteger numberOfLoops Discussion A value of 0, which is the default, means to play the sound once. Set a positive integer value to specify the number of times to return to the start and play again. For example, specifying a value of 1 results in a total of two plays of the sound. Set any negative integer value to loop the sound indefinitely until you call the stop method.
Availability Available in iOS 2.2 and later. Declared In AVAudioPlayer.h
Upvotes: 2