fast forwarding a song using AVAudioPlayer
Use the currentTime
and duration
properties.
i.e. to skip forward
NSTimeInterval time = avPlayer.currentTime;
time += 5.0; // forward 5 secs
if (time > avPLayer.duration)
{
// stop, track skip or whatever you want
}
else
avPLayer.currentTime = time;
Similar for going backwards, only compare currentTime
against 0
, instead of duration