I have had a similar problem lately. The solution turned out to be a bit hacky, but it worked as far as I saw. First I created an observer for new access log notifications:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleAVPlayerAccess:) name:AVPlayerItemNewAccessLogEntryNotification object:nil];
What causes this function. It can probably be optimized, but here is the main idea:
- (void)handleAVPlayerAccess:(NSNotification *)notif { AVPlayerItemAccessLog *accessLog = [((AVPlayerItem *)notif.object) accessLog]; AVPlayerItemAccessLogEvent *lastEvent = accessLog.events.lastObject; float lastEventNumber = lastEvent.indicatedBitrate; if (lastEventNumber != self.lastBitRate) {
Each time a new entry appears in the access log, it checks the last specified bitrate from the most recent entry (the last object in the access log for the player element). It compares the specified bitrate with the property that kept the bitrate from the last change.
source share