I\'m trying to solve an AVAudioSession problem since many hours ago and didn\'t get success!!
I found lots of guys talking about problems with endInterruption but none o
Using @Trinca answer that what I did on "ARC'ed" project:
AudioSessionInitialize (NULL, NULL, interruptionListenerCallback, (__bridge void *)(self.player));
Were self.player is your player instance that you pass to the callback function.
Then implement the callback:
void interruptionListenerCallback (void *inUserData, UInt32 interruptionState) {
NSLog(@"itnerp state %li",interruptionState);
NSLog(@"inUserData %@",inUserData);
AVAudioPlayer *pl = (__bridge AVAudioPlayer*)inUserData;
switch (interruptionState) {
case 0:
[pl play];
break;
case 1:
[pl pause];
break;
}
}
GOOD LUCK
Shani