Listening to the iPhone mic with SCListener and playing music at the same time: how?

Posted by Eamon Ford on Stack Overflow See other posts from Stack Overflow or by Eamon Ford
Published on 2009-08-02T20:25:33Z Indexed on 2010/04/14 19:03 UTC
Read the original article Hit count: 600

Hello,

I am using Stephen Celis' SCListener class (for iPhone) to "listen" from the microphone, but I also need to be playing music at the same time using the MediaPlayer framework. However, when I start listening with SCListener, the music fades out and stops. I have set the kAudioSessionCategory_PlayAndRecord property on the audio session in SCListener, which should allow me to play audio and record audio at the same time, but as far as I can tell it has no effect. I'm confused, because according to other developers' results, this works just fine, but not for me. I'm thinking maybe the kAudioSessionCategory_PlayAndRecord property allows you to play sound and record if you're using the AVAudioPlayer framework or something to play the sound, but maybe not the MediaPlayer framework? This would be a problem for me because I need to play music from the user's iPod library, which, as far as I know is only possible to do using the MediaPlayer framework.

Does anyone know how I can get around this problem? Thanks in advance!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk