2

I'm streaming audio from url by AVPlayer class. How can i get data usage counters (bytes) from AVPlayer or by another way. I've tried this iPhone Data Usage Tracking/Monitoring

but can't get data usage only for my application.

Update: also i tried:

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]);

but it doesn't work for me. Events array always empty.

Community
  • 1
  • 1
rozochkin
  • 679
  • 1
  • 7
  • 18
  • We observe the same thing here. The accessLog is always present, but for audio live streams there are no events. VOD, AOD and Video Lives all have events... – onekiloparsec Jul 16 '15 at 10:19
  • @onekiloparsec, did you found a solution for the empty event array for audio live streams? I'm facing the same problem right now. – dalipsia Dec 21 '16 at 10:05
  • nope. no solution found. we worked out something else. sorry. – onekiloparsec Dec 21 '16 at 16:18

1 Answers1

0

An AVAsset can be loaded by both a local or remote URL via the NSURLConnection class and the NSURLConnectionDataDelegate protocol, which provides methods that the NSURLConnection class calls with progress information during an upload—including bytes transferred.

James Bush
  • 1,485
  • 14
  • 19