MPMovieController bit rate detection

Is there a way to determine the bit rate in a stream that MPMovieController plays? I am programming in objective-c on iOS

+3
source share
2 answers

Found, "accessLog" gives you periodic statistics that include the observed bitrate:

MPMovieAccessLogEvent *evt=nil; MPMovieAccessLog *accessL=[moviePlayer accessLog]; NSArray *events = accessL.events; for (int i=0; i<[events count]; i++) { evt=[events objectAtIndex:i]; } return evt.observedBitrate 
+2
source

You can get the indicated bit rate from the event, which is the bit rate of the stream according to m3u8. To calculate the actual baud rate, I divide the event.numberOfBytesTransferred / event.durationWatched event and multiply by 8.

 NSArray *events = self.player.accessLog.events; MPMovieAccessLogEvent *event = (MPMovieAccessLogEvent *)[events lastObject]; double calculatedBitRate = 8 * event.numberOfBytesTransferred / event.durationWatched; value = [nf stringFromNumber:[NSNumber numberWithDouble:calculatedBitRate]]; self.calculatedBitRateLabel.text = [NSString stringWithFormat:@"My calculated bit rate = %@", value]; 
+4
source

All Articles