Is there a way to detect how much data has been buffered while streaming video in MPMoviePlayerController?
I've already checked loadState but that does not give me enough info about buffering.
Youtube's app has exactly what I want...
Is there a way to detect how much data has been buffered while streaming video in MPMoviePlayerController?
I've already checked loadState but that does not give me enough info about buffering.
Youtube's app has exactly what I want...
You can try to get movie access log during playing video.
- (void)calculateBufferSize
{
NSArray *events = self.moviePlayerController.accessLog.events;
int count = events.count;
for (int i = 0; i < count; i++)
{
MPMovieAccessLogEvent *currentEvent = [events objectAtIndex:i];
int64_t byte = currentEvent.numberOfBytesTransferred;
int64_t bytes = currentEvent.numberOfBytesTransferred >> 10;
NSLog(@"byte = %f M bytes = %lld", (float)byte / (1024 * 1024), bytes);
}
}
Then you can call the above by such as,
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(calculateBufferSize) userInfo:nil repeats:YES];
after
[self.moviePlayerController play];