有没有办法确定MPMovieController正在播放的流的比特率? 我在iOS上的objective-c编程
答案 0 :(得分:4)
您可以从事件中获取指示的比特率,即根据m3u8的流的比特率。为了计算实际比特率,我将event.numberOfBytesTransferred / event.durationWatched除以并乘以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];
答案 1 :(得分:2)
找到它,“accessLog”为您提供定期统计数据,其中包括观察到的比特率:
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