MPMoviePlayer Video Streaming Size

Is there a way to determine how much data was buffered when streaming video to MPMoviePlayerController ?

I already checked loadState , but that does not give me enough buffering information.

The Youtube app has exactly what I want ...

+4
source share
1 answer

You can try to get a movie access log during video playback.

 - (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 above for example

 [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(calculateBufferSize) userInfo:nil repeats:YES]; 

after

 [self.moviePlayerController play]; 

https://developer.apple.com/library/ios/#DOCUMENTATION/MediaPlayer/Reference/MPMovieAccessLog_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40010561

+7
source

All Articles