Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gapless playback with AVQueuePlayer/AVPlayer - is it possible?

I've been playing around with the AVPlayer and its subclass AVQueuePlayer (and an array of MPMediaItems) 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?

like image 819
sooper Avatar asked Apr 23 '12 17:04

sooper


1 Answers

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.

like image 64
hotpaw2 Avatar answered Oct 03 '22 20:10

hotpaw2