Mihai Damian Mihai Damian - 7 months ago 44
Objective-C Question

Pre-buffering for AVQueuePlayer

Does anyone know if

starts buffering the next
when the current item is about to finish playing?

I know there's nothing in the docs to suggest this, I'm asking mostly if anyone has observed this kind of behavior or not.


Ok, I've looked over this problem again and written some code to check out AVQueuePlayer.

jollyCocoa's answer pointed me in the right direction by suggesting to observe the status property on AVPlayerItem. However the documentation doesn't seem to point out that this property (and it's AVPlayerItemStatusReadyToPlay value in particular) might be related to buffering.

However the AVPlayerItem's loadedTimeRanges property seems more related to buffering.

Doing KVO on that array was a bit trickier - the array object itself doesn't change, only it's items do - so I resorted to printing out it's content every second.

What I found out is that a few seconds in the queue's first item, the loadedTimeRanges for the second item shows up a new CMTimeRange with start time 0 and some small duration. The duration can increase up to 60 or so seconds while the previous item keeps playing.

Short answer: AVQueuePlayer will buffer the next AVPlayerItem while playing the current one.