I am recording audio and playing into the headphone. I am using
AVAudioSession to recording and playing audio. Here is my code:
objSession = [AVAudioSession sharedInstance];
[objSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
[objSession setActive: YES error: nil];
[objSession setPreferredIOBufferDuration:0.003 error:nil];
My question is when I run this code it will start recording audio and it will show red bar when we move application to background. Now I want to stop
AVAudionSession. When its stop, then there is no red bar on Home screen.
Here is code to stop audio:
[objSession setActive:NO error: nil];
objSession = nil;
But red bar on the home screen is not accurate and even audio recording is create an issue. So anyone can help to show and hide red bar and handle audio recording?