I am using AVAudioplayer to play some audio files. I have some controls like forward and rewind.
Rewind is working properly but forward is not.
- (void)rewind
{
AVAudioPlayer *player = _rewTimer.userInfo;
player.currentTime-= SKIP_TIME;
[_rewTimer invalidate];
_rewTimer=nil;
[self updateCurrentTime];
}
- (void)ffwd
{
AVAudioPlayer *player = _ffwTimer.userInfo;
player.currentTime-= SKIP_TIME;
[player setCurrentTime:cTime];
[_ffwTimer invalidate];
_ffwTimer=nil;
[self updateCurrentTime];
}
As soon as I click on forward button, the audio file just begins playing from the start.
I have followed the sample app avTouch from Apple.
you might have done the property declaration of
AVAudioPlayer *player;
in the h file and also synthesised it.
Now for forward, just do,
do similarly for rewind+
OR
this one seems the better way, also for rewind compare to 0 instead of duration