确定 MPMovieController 比特率

发布于 12-02 21:06 字数 73 浏览 1 评论 0原文

有没有办法确定 MPMovieController 正在播放的流的比特率? 我正在 iOS 上使用 Objective-C 进行编程

Is there a way to determine the bit-rate of the stream an MPMovieController is playing?
I am programming in objective-c on iOS

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不知所踪2024-12-09 21:06:28

可以从event中获取指示的码率,这是按照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];

You can get the indicated bit rate from event, which is the bit rate of the stream according to the m3u8. To calculate the actual bit rate I divide event.numberOfBytesTransferred / event.durationWatched 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];
荒芜了季节2024-12-09 21:06:28

找到它,“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

Found it, the "accessLog" gives you periodic stats which 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文