I had exactly the same issue and I wasted ten hours on this...
But it fixed now by adding the "insertItem" method into the main thread.
So I have my player as a property :
@property AVQueuePlayer * player;
I just init it like this :
_player = [[AVQueuePlayer alloc] init];
And here is my method to add items from a path :
- (void)addInQueuePlayerFile:(NSString *)path {
AVAsset * asset = [AVAsset assetWithURL:[[NSURL alloc] initFileURLWithPath:path]];
AVPlayerItem * playerItem = [AVPlayerItem playerItemWithAsset:asset];
dispatch_async(dispatch_get_main_queue(), ^{
[_player insertItem:playerItem afterItem:nil];
});
}
So its working but I don't really understand why... So if someone has an answer...
But also if this doesn't work for you, try to add an observer to your player (and/or your playerItem). You can add an observer like that :
[_player addObserver:self forKeyPath:@"status" options:0 context:nil]
And catch it with this method :
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (object == _player && [keyPath isEqualToString:@"status"]) {
if (_player.status == AVPlayerStatusFailed) {
NSLog(@"AVPlayer Failed");
} else if (_player.status == AVPlayerStatusReadyToPlay) {
NSLog(@"AVPlayer item Ready to Play");
} else if (_player.status == AVPlayerStatusUnknown) {
NSLog(@"AVPlayer item Unknown");
}
}
}
Let me know if this work for you.