Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 确定MPMovieController比特率_Iphone_Objective C_Video Streaming - Fatal编程技术网

Iphone 确定MPMovieController比特率

Iphone 确定MPMovieController比特率,iphone,objective-c,video-streaming,Iphone,Objective C,Video Streaming,有没有办法确定MPMovieController正在播放的流的比特率? 我正在iOS上用objective-c编程。找到它后,“accessLog”会定期提供统计信息,包括观察到的比特率: MPMovieAccessLogEvent *evt=nil; MPMovieAccessLog *accessL=[moviePlayer accessLog]; NSArray *events = accessL.events; for (int i=0; i<[events count]; i++

有没有办法确定MPMovieController正在播放的流的比特率? 我正在iOS上用objective-c编程。找到它后,“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
MPMovieAccessLogEvent*evt=nil;
MPMovieAccessLog*accessL=[moviePlayer accessLog];
NSArray*events=accessL.events;

对于(int i=0;i您可以从事件中获得指示的比特率,这是根据m3u8的流的比特率。要计算实际比特率,我将event.numberOfByTestTransferred/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];

你能详细解释一下我们如何使用上面的代码找到视频的进度计时吗?我们需要在哪里使用上面的逻辑?在定义MPMoviePlayerController时应该使用这个吗?我试图通过点击按钮来实现这一点,但我得到了下面的格式。访问日志是10097249,访问日志是10035010.但我想得到视频播放的实际时间。我有一个按钮,按下视频。我想在点击按钮时捕捉视频的特定时间。你能帮我吗?上面的代码是获取流的当前比特率,而不是位置。evt中还有其他统计信息(其中一个可能会提供您所需的信息)您需要将此代码包装在一个由NSTimer发送消息的方法中。@eshalev:您能指导我如何使用此方法切换URL流吗?我发现您给出的上述比特率计算显示了一个非常高的比特率值,请您详细解释一下。