Search code examples
iphoneiosios4avaudioplayeravfoundation

Is it possible to play just a part of an mp3 file with AVAudioPlayer? If yes, how?


Hi I have a locally stored 5:00 minutes mp3 files in my iPhone app.

I would like to know if it is possible to play just an interval from that file using AVAudioPlayer after it is readyToPlay, lets say from 0:25 to 1:34.

If it is possible how can I achieve that?

I know I can move the playhead cursor using setCurrentTime: but how do I let the AVAudioPlayer know how many seconds it should play from that currentTime.

Any help is highly appreciated.


Solution

  • You will need to set a timer which will stop that playing after particular time interval.