The issue is that player.status returns AVPlayerStatusReadyToPlay
a full 2 seconds before player.currentItem.status returns AVPlayerItemStatusReadyToPlay
. Does anyone have any helpful explanations as to why this is happening?
This is just sample code to show the basic idea of what's happening so if there are any typos or whatever please ignore them.
- (void) someMethod
{
player = [[AVPlayer alloc] initWithURL:someValidURL];
[player play];
NSTimer *timer = [NSTimer timerWithTimeInterval:0.1 target:self selector:@selector(checkStatus:) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
}
- (void) checkStatus: (NSTimer *)timer
{
NSLog(@"player status: %i", player.status]);
NSLog(@"player item status: %i", player.currentItem.status]);
}