View Full Version : KVO for AVAudioPlayer not working.

May 8, 2011, 09:46 PM
Hi, I am trying to observe the "currentTime" property of AVAudioPlayer. But the method isn't even being called... I need it to set the position of a UISlider.. But it's not working. Here's the relevant code:

[audioPlayer addObserver:self forKeyPath:@"currentTime" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];

- (void)observeValueForKeyPath:(NSString *)keyPath
change:(NSDictionary *)change
context:(void *)context {
NSLog(@"%@", change);

May 8, 2011, 10:24 PM
According to the developer docs for AVAudioPlayer, it does not respond to any of the NSKeyValueObserving messages. Do you know if it's KVO compliant? If it's not, then you can't observe property changes on it.