Gapless playback with AVQueuePlayer/AVPlayer - is it possible?
avplayer, avqueueplayer, ios
Solution
You can use the AVAssetReader or Extended Audio File Services API to read data from the audio files, and then feed uncompressed audio data to an Audio Unit mixer with any desired gap, gapless, overlap, or even mix. Proper use of all these APIs is non-trivial.
Problem
I've been playing around with the `AVPlayer` and its subclass `AVQueuePlayer` (and an array of `MPMediaItem`s) and have found that the latter performs better with gapless albums, but neither seem to fully achieve the task. There is a very noticeable pause between the current and next track when using `AVPlayer`'s `replaceCurrentItemWithPlayerItem` method. But with `AVQueuePlayer`'s `advanceToNextItem` method the gap is much more narrow. The only options are these two classes since I'm dealing with `AVPlayerItem`'s that contain Asset URLs from items in the iTunes music library. This then begs the question, is it at all possible to achieve gapless playback with the iOS SDK?