I'm using iOS 5 with ARC enabled. I'm playing a recording associated with a particular view when the view is tapped. When the user changes views, the playback stops. I used NSNotification to call the -stopPlayback method which works fine. The problem is that when the user returns to the original view and taps it, it continues where the recording left off.
With ARC disabled I could use the following code:
-stopPlayback
{
if([audioPlayer isPlaying])
{
[audioPlayer stop];
[audioPlayer release];
audioPlayer = nil;
}
}
Since ARC doesn't allow [audioPlayer release], I can't reset the playback from the beginning.I removed the [audioPlayer release] and audioPlayer=nil; since ARC will handle it and the result is the recording plays where it left off after the previous stop. I'm not seeing any good examples or documentation from Apple on how to restart the recording from the beginning when playback occurs. What is the best way to proceed?