2

I create an avaudiosession in my app delegate and add an observer.

AVAudioSession *sessionInstance = [AVAudioSession sharedInstance];
[sessionInstance setCategory:AVAudioSessionCategoryPlayback error:&error];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(handleInterruption:)
                                             name:AVAudioSessionInterruptionNotification
                                           object:nil];

[sessionInstance setActive:YES error:&error];

When there is a phone call, it calls selector handleInterruption method. But, when the phone call is end, it does not call handleInterruption for the interruption type AVAudioSessionInterruptionTypeEnded.

Instead, it delegates

- (void)observeValueForKeyPath:(NSString*) path
                  ofObject:(id)object
                    change:(NSDictionary*)change
                   context:(void*)context

method for the status key of music player item.

How can i handle this?

hamzaozturk
  • 453
  • 1
  • 5
  • 12
  • I tried to solve problem. When i observe AVPlayerItem status, it confuses and does not handle interruption of the ending phone call. Therefore, after AVPlayerItem status is ready, i remove the observer on the item. – hamzaozturk Apr 25 '15 at 18:19

0 Answers0