I am playing live audio stream using AVPlayer
and AVPlayerItem
and trying to determine the current bit rate of the stream. I searched in the net and found this help :
Determening MPMovieController bit-rate
Inspired by the above thread, I tried to compute it using the following code:
NSArray *logEvents=playerItem.accessLog.events;
AVPlayerItemAccessLogEvent *event = (AVPlayerItemAccessLogEvent *)[logEvents lastObject];
double bitRate=event.observedBitrate;
But the variable bitRate
is always zero when checked inside a timer.
In fact [logEvents count]
is also always zero.
Could you please tell me what is wrong with the technique ?
Thanks a lot.