See here: AVPlayer streaming progress
And here: How to get file size and current file size from NSURL for AVPlayer iOS4.0
You can observer the property "currentitem.loadedTimeRanges" of the player, and when the events are thrown, you can check how much was buffered, before beginning play back. Here is an example of how I use it:
#define VIDEO_BUFFER_READY_PERCENT 0.3
- (void)viewDidLoad{
[super viewDidLoad];
[self.player addObserver:self forKeyPath:@"currentItem.loadedTimeRanges" options:NSKeyValueObservingOptionNew context:&kTimeRangesKVO];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (context == &kTimeRangesKVO) {
float percent = CMTimeGetSeconds(timerange.duration) / CMTimeGetSeconds(self.player.currentItem.duration);
if (percent > VIDEO_BUFFER_READY_PERCENT) {
NSLog(@" . . . %.5f -> %.5f, %f percent", CMTimeGetSeconds(timerange.duration), CMTimeGetSeconds(CMTimeAdd(timerange.start, timerange.duration)), percent);
[self.player prerollAtRate:0.0 completionHandler:^(BOOL finished) {
[self.player seekToTime:kCMTimeZero];
}
}
else{
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}