I need to do something like this. That my app do recording using AVCapturesession but it should be able to stream the live feed with background music that I had played.
Remember i am able to play background music with the AVCapturesession,but the problem is that it also involve the sound of surrounding environment.
Here is the audiosession category I am using
AudioSessionInitialize(NULL, NULL, NULL, self);
// //set the audio category
UInt32 audioCategory = kAudioSessionCategory_PlayAndRecord;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(audioCategory), &audioCategory);
// mix with others!! this allows using AVCaptureSession and AusioSession simultaniously
UInt32 doSetProperty = 1;
AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof(doSetProperty), &doSetProperty);
AudioSessionSetActive(YES);
I have tried out almost all combination of category but I am not able to get required output, SoloAmbient and Ambient don't play sound at all.
I had also tried to disable audioinput of the AVCapturesession but it does not help.