Skip to content
Thong Nguyen edited this page Apr 25, 2014 · 9 revisions

Overview

StreamingKit supports gapless playback. You can queue files to play via the queueDataSource:withQueueItemId. Items are buffered into memory and played back in the order in which they are queued. As long as there is buffer space available and files on the queue, StreamingKit will download, decode and ready packets to be played. If you call any of the play methods or setDataSource: the current queue will be wiped and the new dataSource will be queued as the single and first item in the queue.

The audioPlayer:audioPlayer:didFinishBufferingSourceWithQueueItemId: delegate callback is invoked when a queued file has finished buffering into memory. This callback can be used to queue items more items to be played on demand (rather than just filling the upcoming queue all at once).

Queue Management

The StreamingKit player is designed to be purely focused on gapless playback and data/input management. Playlist management should be provided by your own playback and playlist management classes. The following actions will cause the upcoming queue to be flushed/cleared:

  • Calling STKAudioPlayer:play, STKAudioPlayer:setDataSource, STKAudioPlayer:stop
  • Calling STKAudioPlayer:seekToTime (if the STKAudioPlayerOptionFlushQueueOnSeek option is on)

Because seekToTime may cause any item in the queue that has already been buffered to rebuffer from the disk or network, the didFinishBufferingSourceWithQueueItemId event may be raised multiple times for a single item. Keep this in mind if you use the didFinishBufferingSourceWithQueueItemId to queue on new items. The queueItemId provided by the event is not necessarily the last item on the queue. You should use the mostRecentlyQueuedStillPendingItem property to determine the last on the queue.

Clone this wiki locally