0

您好,我正在使用 AVFoundation 框架播放来自互联网的剪辑。我用AVPlayerItem playerItemWithURL:URL

现在我想检查从该视频文件接收到的字节的大小。我在此页面上找不到任何相关内容: https ://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVPlayerItem_Class/Reference/Reference.html

那么有没有办法找到接收到的字节大小?

4

1 回答 1

5

看看AVPlayerItemAccessLogEvent类。

您可以通过`访问

self.aPlayer.currentItem.accessLog
AVPlayerItemAccessLog *accesslog = self.aPlayer.currentItem.accessLog;  
NSArray *events = [accesslog events];    
AVPlayerItemAccessLogEvent *event = [events objectAtIndex:0]; 
NSLog(@"Number of bytes received %@", [event numberOfBytesTransferred]);

您有 Accesslog,它为您提供有关数据属性的详细信息

  numberOfSegmentsDownloaded  property
  numberOfMediaRequests  property
  playbackStartDate  property
  URI  property
  serverAddress  property
  numberOfServerAddressChanges  property
  playbackSessionID  property
  playbackStartOffset  property
  segmentsDownloadedDuration  property
  durationWatched  property
  numberOfStalls  property
  numberOfBytesTransferred  property
  indicatedBitrate  property
  observedBitrate  property
  numberOfDroppedVideoFrames  property

IMO,这是您唯一的选择,但这也有其缺陷,尤其是在寻求等时。

于 2013-01-03T07:57:42.643 回答