Reputation:
I am trying to play music from the user's music library and at the same time record from the built-in microphone. However, as soon as I start recording from the microphone it automatically pauses the music, and I can't find any way to play music and record at the same time. I am using the MediaPlayer framework to play music and the AudioToolbox framework to record from the mic.
Does anyone know if it is possible to play music and record from the mic at the same time, and if so how to do it?
Upvotes: 2
Views: 10664
Reputation: 175
try:
Add #import "CDAudioManager.h"to AppDelegate.m and Add [CDAudioManager initAsynchronously:kAMM_PlayAndRecord]; to - (void) applicationDidFinishLaunching:(UIApplication*)application
Upvotes: 0
Reputation: 36074
You set your audio session to kAudioSessionCategory_PlayAndRecord
and create an in/out remote io audio unit.
The "loopy" author talks about how to do this here and provides code.
The trailblazing tones of the article are slightly dated now.
Upvotes: 3
Reputation: 19782
You'll need to set your audiosession properties to allow both recording and playback. This might mean that you need to use AudioToolbox for the playback as well as the recording.
Upvotes: 0