iOS: AVQueuePlayer/AVPlayerItem 'An AVPlayerItem can occupy only one position in a player's queue at a time.'

Posted by JoshDG on Stack Overflow See other posts from Stack Overflow or by JoshDG
Published on 2013-10-27T19:04:58Z Indexed on 2013/10/29 15:54 UTC
Read the original article Hit count: 1191

I keep getting this error:

'An AVPlayerItem can occupy only one position in a player's queue at a time.'

I NSLog'd the players items, and none of them seem to be equal. Further, I added this just to be sure:

if([player canInsertItem:itemToAdd afterItem:nil])
 [player insertItem:itemToAdd afterItem:nil];

When I wasn't sure if that would work (can have two identical items in different memory locations) I wrote a category method to test if a player contains an item or something identical to it. Yet, I'm still getting the error.

I've seen several posts of people getting this error with MPMoviePlayerController, but I'm not using that custom class, just the out of the box AVQueuePlayer.

Any ideas on how to fix this?

© Stack Overflow or respective owner

Related posts about ios

Related posts about objective-c