I created a camera using AVCaptureSession . I configured this for photo and video modes .
The camera and application are working fine. In addition, I enabled background music (if the user is playing a song using the Music App on the iPhone) while the camera is open or video is being recorded. It also works great. (Attached Image 2)
I enabled background music playback with this code
AVAudioSession *session1 = [AVAudioSession sharedInstance]; [session1 setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers|AVAudioSessionCategoryOptionDefaultToSpeaker|AVAudioSessionCategoryOptionAllowBluetooth error:nil]; [session1 setActive:YES error:nil]; [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
Now, if I get a call , hide the phone call screen by pressing the "Home" button and open the application, and you want to open the camera screen to capture an image / record video, it opens, but it freezes with an image (Attached Image (1)).
Now my requirement: I want to capture an image / video recording during a phone call. I searched for other apps, and Snapchat does the same , and I can record videos while I call.
Please help me how can I achieve this.

ios objective-c avcapturesession avaudiosession
Surjeet
source share