I play audio files from AVPlayer. I have implemented AVAudioSessionInterruptionNotification.
AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *errorInAudio = nil;
[session setActive:YES error:&errorInAudio];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(interruption:) name:AVAudioSessionInterruptionNotification object:nil];
[session setCategory:AVAudioSessionCategoryPlayback error:nil];
It works great when an interrupt arrives when the application is in the foreground (e.g. voice control).
But I made the application in the background and opened the iPod and started playing. Its interruption is not called at that time and even when my application has come to the fore.
What could be the problem. Please, help.
source
share