AVPlayerItem fails with AVStatusFailed and error code “Cannot Decode”

Ok everyone, I have the answer to this straight from Apple. I used one of my developer TSI lifelines to ask the question, and I’ll summarize the response.

There is a limit on the number of concurrent video players that AVFoundation will allow. It is due to the limitations of iOS hardware. The limit for current devices is 4 players. If you create a 5th player, you will get the “cannot decode” error. It is not a limit on the number of instances of AVPlayer, or AVPlayerItem. Rather,it is the association of AVPlayerItem with an AVPlayer which creates a “render pipeline”, and you are limited to 4 of these. For example, this causes a new render pipeline:

AVPlayer *player = [AVPlayer playerWithPlayerItem:somePlayerItem];  
// assuming the AVPlayerItem is ready to go with an AVAsset that has been loaded

I was also warned that you cannot assume that you will have 4 pipelines available to you. Another App may be using one or more. Indeed, I have seen this happen on an iPad, but it was not clear which app was using a pipeline.

So, there you go, it was totally undocumented, but that is the story.

Leave a Comment