I am trying to loop a segment of an MP3 loaded from the users iPod library. By segment I mean, I don’t want to loop the entire MP3 but only a section of it.
So say the MP3 is 4 minutes long, I have defined startTime, and endTime.
When the play button is hit, I seek the player to startTime and begin play.
I’m also subscribed to the event listener [AVPlayer addBoundaryTimeObserverForTimes:…] to be notified when my endTime has hit. At which point, I seek back to startTime and play.
** However, this does not provide a seamless loop – there is a split second where the sound stops before playing at startTime again.. My application is music making software, so it is important that the loop is perfect. Please help!
Apple has a Technical Q&A called Exporting a Trimmed Audio Asset.
Also, take a look at this thread, which deals with trimming an AVAsset audio file.