Ios AVPlayer数据使用
我正在通过AVPlayer类从url传输音频。如何从AVPlayer或通过其他方式获取数据使用计数器(字节)。 我试过这个 但无法仅获取我的应用程序的数据使用情况 更新: 我也试过:Ios AVPlayer数据使用,ios,avplayer,network-traffic,Ios,Avplayer,Network Traffic,我正在通过AVPlayer类从url传输音频。如何从AVPlayer或通过其他方式获取数据使用计数器(字节)。 我试过这个 但无法仅获取我的应用程序的数据使用情况 更新: 我也试过: self.aPlayer.currentItem.accessLog AVPlayerItemAccessLog *accesslog = self.aPlayer.currentItem.accessLog; NSArray *events = [accesslog events]; AVPlayer
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]);
但这对我不起作用。事件数组始终为空。可以通过NSURLConnection类和NSURLConnectionDataDelegate协议通过本地或远程URL加载AVAsset,该协议提供了NSURLConnection类在上载过程中使用进度信息调用的方法,包括传输的字节。我们在这里观察到同样的情况。accessLog始终存在,但对于音频直播流,没有任何事件。VOD、AOD和视频直播都有事件…@onekiloparsec,你找到音频直播流的空事件阵列的解决方案了吗?我现在也面临同样的问题。没有找到解决方案。我们想出了别的办法。很抱歉